Roblox Aimbot mobile team (T to toggle teams C for camera)

public
vxpreen Jun 21, 2024 Never 137
Clone
Lua paste1.txt 123 lines (108 loc) | 4.31 KB
1
-- loadstring(game:HttpGet("https://pastecode.dev/raw/epzf1ncl/paste1.txt"))()
2
3
local fov = 100
4
local maxTransparency = 0.1
5
local smoothness = 1
6
local RunService = game:GetService("RunService")
7
local UserInputService = game:GetService("UserInputService")
8
local Players = game:GetService("Players")
9
local Teams = game:GetService("Teams")
10
local Cam = game.Workspace.CurrentCamera
11
local LocalPlayer = Players.LocalPlayer
12
13
local FOVring = Drawing.new("Circle")
14
FOVring.Visible = true
15
FOVring.Thickness = 2
16
FOVring.Color = Color3.fromRGB(128, 0, 128)
17
FOVring.Filled = false
18
FOVring.Radius = fov
19
FOVring.Position = Cam.ViewportSize / 2
20
FOVring.Transparency = 0.1
21
22
local teamsEnabled = true
23
local targeting = false
24
local targetPlayer = nil
25
26
local function updateDrawings()
27
local camViewportSize = Cam.ViewportSize
28
FOVring.Position = camViewportSize / 2
29
end
30
31
local function onKeyDown(input)
32
if input.KeyCode == Enum.KeyCode.Delete then
33
RunService:UnbindFromRenderStep("FOVUpdate")
34
FOVring:Remove()
35
elseif input.KeyCode == Enum.KeyCode.T then
36
teamsEnabled = not teamsEnabled
37
print("Teams enabled: " .. tostring(teamsEnabled))
38
elseif input.KeyCode == Enum.KeyCode.C then
39
targeting = not targeting
40
if targeting then
41
targetPlayer = getClosestPlayer("Head")
42
else
43
targetPlayer = nil
44
end
45
end
46
end
47
48
UserInputService.InputBegan:Connect(onKeyDown)
49
50
local function lookAt(target, smoothness)
51
local lookVector = (target - Cam.CFrame.Position).unit
52
local currentLookVector = Cam.CFrame.LookVector
53
local newLookVector = currentLookVector:Lerp(lookVector, smoothness)
54
local newCFrame = CFrame.new(Cam.CFrame.Position, Cam.CFrame.Position + newLookVector)
55
Cam.CFrame = newCFrame
56
end
57
58
local function calculateTransparency(distance)
59
local maxDistance = fov
60
local transparency = (1 - (distance / maxDistance)) * maxTransparency
61
return transparency
62
end
63
64
local function WallCheck(destination, ignore)
65
local Origin = Cam.CFrame.p
66
local CheckRay = Ray.new(Origin, destination - Origin)
67
local Hit = game.workspace:FindPartOnRayWithIgnoreList(CheckRay, ignore)
68
return Hit == nil
69
end
70
71
local function getClosestPlayer(trg_part)
72
local nearest = nil
73
local last = math.huge
74
local localPlayer = Players.LocalPlayer
75
local localPlayerTeam = localPlayer.Team
76
77
for _, player in ipairs(Players:GetPlayers()) do
78
if player ~= localPlayer then
79
local part = player.Character and player.Character:FindFirstChild(trg_part)
80
if part then
81
local distance = (part.Position - localPlayer.Character.PrimaryPart.Position).Magnitude
82
83
if teamsEnabled and player.Team ~= localPlayerTeam then
84
if WallCheck(part.Position, {localPlayer.Character, player.Character}) then
85
if distance < last then
86
last = distance
87
nearest = player
88
end
89
end
90
elseif not teamsEnabled then
91
if WallCheck(part.Position, {localPlayer.Character, player.Character}) then
92
if distance < last then
93
last = distance
94
nearest = player
95
end
96
end
97
end
98
end
99
end
100
end
101
102
return nearest
103
end
104
105
RunService.RenderStepped:Connect(function()
106
updateDrawings()
107
local closest = getClosestPlayer("Head")
108
if targeting and targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("Head") then
109
lookAt(targetPlayer.Character.Head.Position, smoothness)
110
elseif closest and closest.Character:FindFirstChild("Head") then
111
lookAt(closest.Character.Head.Position, smoothness)
112
113
if closest then
114
local ePos, isVisible = Cam:WorldToViewportPoint(closest.Character.Head.Position)
115
local distance = (Vector2.new(ePos.x, ePos.y) - (Cam.ViewportSize / 2)).Magnitude
116
FOVring.Transparency = calculateTransparency(distance)
117
else
118
FOVring.Transparency = 0.1
119
end
120
else
121
FOVring.Transparency = 0.1
122
end
123
end)