forked from zxciaz/Universal-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAimbot
More file actions
225 lines (209 loc) · 9.63 KB
/
Aimbot
File metadata and controls
225 lines (209 loc) · 9.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
--[[
getgenv().AimPart = "HumanoidRootPart" -- For R15 Games: {UpperTorso, LowerTorso, HumanoidRootPart, Head} | For R6 Games: {Head, Torso, HumanoidRootPart}
getgenv().AimlockToggleKey = "Y" -- Toggles Aimbot On/Off
getgenv().AimRadius = 50 -- How far away from someones character you want to lock on at
getgenv().ThirdPerson = false -- Locking onto someone in your Third Person POV
getgenv().FirstPerson = true -- Locking onto someone in your First Person POV
getgenv().TeamCheck = false -- Check if Target is on your Team (True means it wont lock onto your teamates, false is vice versa) (Set it to false if there are no teams)
getgenv().PredictMovement = true -- Predicts if they are moving in fast velocity (like jumping) so the aimbot will go a bit faster to match their speed
getgenv().PredictionVelocity = 10 -- The speed of the PredictMovement feature
]]--
getgenv().CiazwareUniversalAimbotLoadingTime = tick()
if CiazwareUniversalAimbotLoaded == true then
Notify("Ciazware", "Script Loaded Already", "", 3)
return
end
local Players, Uis, RService, SGui = game:GetService"Players", game:GetService"UserInputService", game:GetService"RunService", game:GetService"StarterGui";
local Client, Mouse, Camera, CF, RNew, Vec3, Vec2 = Players.LocalPlayer, Players.LocalPlayer:GetMouse(), workspace.CurrentCamera, CFrame.new, Ray.new, Vector3.new, Vector2.new;
local Aimlock, MousePressed, CanNotify = true, false, false;
local AimlockTarget;
getgenv().CiazwareUniversalAimbotLoaded = true
getgenv().SeparateNotify = function(title, text, icon, time)
SGui:SetCore("SendNotification",{
Title = title;
Text = text;
Icon = "rbxassetid://5793181157";
Duration = time;
})
end
getgenv().Notify = function(title, text, icon, time)
if CanNotify == true then
if not time or not type(time) == "number" then time = 3 end
SGui:SetCore("SendNotification",{
Title = title;
Text = text;
Icon = "rbxassetid://5793181157";
Duration = time;
})
end
end
getgenv().WorldToViewportPoint = function(P)
return Camera:WorldToViewportPoint(P)
end
getgenv().WorldToScreenPoint = function(P)
return Camera.WorldToScreenPoint(Camera, P)
end
getgenv().GetObscuringObjects = function(T)
if T and T:FindFirstChild(getgenv().AimPart) and Client and Client.Character:FindFirstChild("Head") then
local RayPos = workspace:FindPartOnRay(RNew(
T[getgenv().AimPart].Position, Client.Character.Head.Position)
)
if RayPos then return RayPos:IsDescendantOf(T) end
end
end
getgenv().GetNearestTarget = function()
-- Credits to whoever made this, i didnt make it, and my own mouse2plr function kinda sucks
local players = {}
local PLAYER_HOLD = {}
local DISTANCES = {}
for i, v in pairs(Players:GetPlayers()) do
if v ~= Client then
table.insert(players, v)
end
end
for i, v in pairs(players) do
if v.Character ~= nil then
local AIM = v.Character:FindFirstChild("Head")
if getgenv().TeamCheck == true and v.Team ~= Client.Team then
local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
local DIFF = math.floor((POS - AIM.Position).magnitude)
PLAYER_HOLD[v.Name .. i] = {}
PLAYER_HOLD[v.Name .. i].dist= DISTANCE
PLAYER_HOLD[v.Name .. i].plr = v
PLAYER_HOLD[v.Name .. i].diff = DIFF
table.insert(DISTANCES, DIFF)
elseif getgenv().TeamCheck == false and v.Team == Client.Team then
local DISTANCE = (v.Character:FindFirstChild("Head").Position - game.Workspace.CurrentCamera.CFrame.p).magnitude
local RAY = Ray.new(game.Workspace.CurrentCamera.CFrame.p, (Mouse.Hit.p - game.Workspace.CurrentCamera.CFrame.p).unit * DISTANCE)
local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
local DIFF = math.floor((POS - AIM.Position).magnitude)
PLAYER_HOLD[v.Name .. i] = {}
PLAYER_HOLD[v.Name .. i].dist= DISTANCE
PLAYER_HOLD[v.Name .. i].plr = v
PLAYER_HOLD[v.Name .. i].diff = DIFF
table.insert(DISTANCES, DIFF)
end
end
end
if unpack(DISTANCES) == nil then
return nil
end
local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
if L_DISTANCE > getgenv().AimRadius then
return nil
end
for i, v in pairs(PLAYER_HOLD) do
if v.diff == L_DISTANCE then
return v.plr
end
end
return nil
end
--[[getgenv().CheckTeamsChildren = function()
if workspace and workspace:FindFirstChild"Teams" then
if getgenv().TeamCheck == true then
if #workspace.Teams:GetChildren() == 0 then
getgenv().TeamCheck = false
SeparateNotify("Ciazware", "TeamCheck set to: "..tostring(getgenv().TeamCheck).." because there are no teams!", "", 3)
end
end
end
end
CheckTeamsChildren()
]]--
--[[getgenv().GetNearestTarget = function()
local T;
for _, p in next, Players:GetPlayers() do
if p ~= Client then
if p.Character and p.Character:FindFirstChild(getgenv().AimPart) then
if getgenv().TeamCheck == true and p.Team ~= Client.Team then
local Pos, ScreenCheck = WorldToScreenPoint(p.Character[getgenv().AimPart].Position)
Pos = Vec2(Pos.X, Pos.Y)
local MPos = Vec2(Mouse.X, Mouse.Y) -- Credits to CriShoux for this
local Distance = (Pos - MPos).Magnitude;
if Distance < getgenv().AimRadius then
T = p
end
elseif getgenv().TeamCheck == false and p.Team == Client.Team then
local Pos, ScreenCheck = WorldToScreenPoint(p.Character[getgenv().AimPart].Position)
Pos = Vec2(Pos.X, Pos.Y)
local MPos = Vec2(Mouse.X, Mouse.Y) -- Credits to CriShoux for this
local Distance = (Pos - MPos).Magnitude;
if Distance < getgenv().AimRadius then
T = p
end
end
end
end
end
if T then
return T
end
end]]--
Uis.InputBegan:Connect(function(Key)
if not (Uis:GetFocusedTextBox()) then
if Key.UserInputType == Enum.UserInputType.MouseButton2 then
pcall(function()
if MousePressed ~= true then MousePressed = true end
local Target;Target = GetNearestTarget()
if Target ~= nil then
AimlockTarget = Target
Notify("Ciazware", "Aimlock Target: "..tostring(AimlockTarget), "", 3)
end
end)
end
if Key.KeyCode == Enum.KeyCode[AimlockToggleKey] then
Aimlock = not Aimlock
Notify("Ciazware", "Aimlock: "..tostring(Aimlock), "", 3)
end
end
end)
Uis.InputEnded:Connect(function(Key)
if not (Uis:GetFocusedTextBox()) then
if Key.UserInputType == Enum.UserInputType.MouseButton2 then
if AimlockTarget ~= nil then AimlockTarget = nil end
if MousePressed ~= false then
MousePressed = false
end
end
end
end)
RService.RenderStepped:Connect(function()
if getgenv().FirstPerson == true and getgenv().ThirdPerson == false then
if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude <= 1 then
CanNotify = true
else
CanNotify = false
end
elseif getgenv().ThirdPerson == true and getgenv().FirstPerson == false then
if (Camera.Focus.p - Camera.CoordinateFrame.p).Magnitude > 1 then
CanNotify = true
else
CanNotify = false
end
end
if Aimlock == true and MousePressed == true then
if AimlockTarget and AimlockTarget.Character and AimlockTarget.Character:FindFirstChild(getgenv().AimPart) then
if getgenv().FirstPerson == true then
if CanNotify == true then
if getgenv().PredictMovement == true then
Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
elseif getgenv().PredictMovement == false then
Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
end
end
elseif getgenv().ThirdPerson == true then
if CanNotify == true then
if getgenv().PredictMovement == true then
Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position + AimlockTarget.Character[getgenv().AimPart].Velocity/PredictionVelocity)
elseif getgenv().PredictMovement == false then
Camera.CFrame = CF(Camera.CFrame.p, AimlockTarget.Character[getgenv().AimPart].Position)
end
end
end
end
end
end)
SeparateNotify("Ciazware", "Universal Aimbot loaded in: "..string.format("%.7f", tostring(tick() - CiazwareUniversalAimbotLoadingTime)), "", 3)