_G.AutoSlap = true
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local function getSlap()
return LocalPlayer.Character:WaitForChild("SLAPtula"):WaitForChild("SlapTool_Comm"):WaitForChild("RF"):WaitForChild("Slap")
end
local function getClosestPlayer()
local lpChar = LocalPlayer.Character
if not lpChar or not lpChar:FindFirstChild("HumanoidRootPart") then return end
local closest, closestDist = nil, 20
for _, player in pairs(Players:GetPlayers()) do
local char = player.Character
if player ~= LocalPlayer and char and char:FindFirstChild("HumanoidRootPart") then
local dist = (char.HumanoidRootPart.Position - lpChar.HumanoidRootPart.Position).Magnitude
if dist <= closestDist then
closestDist = dist
closest = player
end
end
end
return closest
end
RunService.RenderStepped:Connect(function()
if _G.AutoSlap then
local target = getClosestPlayer()
if target then
getSlap():InvokeServer(target, Vector3.new(1,0,1))
end
end
end)No comments yet. Be the first to comment!
1_G.AutoSlap = true
2local Players = game:GetService("Players")
3local RunService = game:GetService("RunService")
4local LocalPlayer = Players.LocalPlayer
5local function getSlap()
6 return LocalPlayer.Character:WaitForChild("SLAPtula"):WaitForChild("SlapTool_Comm"):WaitForChild("RF"):WaitForChild("Slap")
7end
8local function getClosestPlayer()
9 local lpChar = LocalPlayer.Character
10 if not lpChar or not lpChar:FindFirstChild("HumanoidRootPart") then return end
11 local closest, closestDist = nil, 20
12 for _, player in pairs(Players:GetPlayers()) do
13 local char = player.Character
14 if player ~= LocalPlayer and char and char:FindFirstChild("HumanoidRootPart") then
15 local dist = (char.HumanoidRootPart.Position - lpChar.HumanoidRootPart.Position).Magnitude
16 if dist <= closestDist then
17 closestDist = dist
18 closest = player
19 end
20 end
21 end
22 return closest
23end
24RunService.RenderStepped:Connect(function()
25 if _G.AutoSlap then
26 local target = getClosestPlayer()
27 if target then
28 getSlap():InvokeServer(target, Vector3.new(1,0,1))
29 end
30 end
31end)