local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local RunService = game:GetService("RunService")
local spamActive = false
local spamDelay = 0.01
local spamLoop
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Parent = PlayerGui
local Button = Instance.new("TextButton")
Button.Size = UDim2.new(0, 100, 0, 50)
Button.Position = UDim2.new(0.5, -50, 0.8, 0)
Button.BackgroundColor3 = Color3.fromRGB(0,0,0)
Button.TextColor3 = Color3.fromRGB(255,255,255)
Button.Text = "Auto Punch"
Button.Parent = ScreenGui
Button.ZIndex = 10
Button.Active = true
Button.Draggable = true -- Permite drag no mobile
local function getClosestPlayer()
local Character = LocalPlayer.Character
if not Character then return nil end
local RootPart = Character:FindFirstChild("HumanoidRootPart")
if not RootPart then return nil end
local closestPlayer = nil
local shortestDistance = math.huge
for _, player in pairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
local distance = (RootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude
if distance < shortestDistance then
shortestDistance = distance
closestPlayer = player
end
end
end
return closestPlayer
end
local function spamPunch()
local targetPlayer = getClosestPlayer()
if targetPlayer and targetPlayer.Character then
local targetLeg = targetPlayer.Character:FindFirstChild("RightLowerLeg")
if targetLeg then
local args = {
1,
targetPlayer.Character,
282,
targetLeg
}
ReplicatedStorage:WaitForChild("MainEvents"):WaitForChild("PUNCHEVENT"):FireServer(unpack(args))
end
end
end
local function startSpam()
if spamLoop then return end -- evita mΓΊltiplos loops
spamLoop = RunService.Heartbeat:Connect(function()
if spamActive then
spamPunch()
wait(spamDelay)
end
end)
end
Button.MouseButton1Click:Connect(function()
spamActive = not spamActive
Button.Text = spamActive and "Auto Punch β
" or "Auto Punch"
if spamActive then
startSpam()
end
end)
local function stopSpam()
if spamLoop then
spamLoop:Disconnect()
spamLoop = nil
end
end
RunService.Heartbeat:Connect(function()
if not spamActive then
stopSpam()
end
end)Open-source Kill Aura script for School Mayhem π. Automatically targets and attacks nearby players for faster fights and smoother combat. Simple, lightweight, and easy to modify for your own needs.
No comments yet. Be the first to comment!
1local Players = game:GetService("Players")
2local ReplicatedStorage = game:GetService("ReplicatedStorage")
3local LocalPlayer = Players.LocalPlayer
4local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
5local RunService = game:GetService("RunService")
6
7local spamActive = false
8local spamDelay = 0.01
9local spamLoop
10
11local ScreenGui = Instance.new("ScreenGui")
12ScreenGui.Parent = PlayerGui
13
14local Button = Instance.new("TextButton")
15Button.Size = UDim2.new(0, 100, 0, 50)
16Button.Position = UDim2.new(0.5, -50, 0.8, 0)
17Button.BackgroundColor3 = Color3.fromRGB(0,0,0)
18Button.TextColor3 = Color3.fromRGB(255,255,255)
19Button.Text = "Auto Punch"
20Button.Parent = ScreenGui
21Button.ZIndex = 10
22Button.Active = true
23Button.Draggable = true -- Permite drag no mobile
24
25local function getClosestPlayer()
26 local Character = LocalPlayer.Character
27 if not Character then return nil end
28 local RootPart = Character:FindFirstChild("HumanoidRootPart")
29 if not RootPart then return nil end
30
31 local closestPlayer = nil
32 local shortestDistance = math.huge
33
34 for _, player in pairs(Players:GetPlayers()) do
35 if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
36 local distance = (RootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude
37 if distance < shortestDistance then
38 shortestDistance = distance
39 closestPlayer = player
40 end
41 end
42 end
43
44 return closestPlayer
45end
46
47local function spamPunch()
48 local targetPlayer = getClosestPlayer()
49 if targetPlayer and targetPlayer.Character then
50 local targetLeg = targetPlayer.Character:FindFirstChild("RightLowerLeg")
51 if targetLeg then
52 local args = {
53 1,
54 targetPlayer.Character,
55 282,
56 targetLeg
57 }
58 ReplicatedStorage:WaitForChild("MainEvents"):WaitForChild("PUNCHEVENT"):FireServer(unpack(args))
59 end
60 end
61end
62
63local function startSpam()
64 if spamLoop then return end -- evita mΓΊltiplos loops
65 spamLoop = RunService.Heartbeat:Connect(function()
66 if spamActive then
67 spamPunch()
68 wait(spamDelay)
69 end
70 end)
71end
72
73Button.MouseButton1Click:Connect(function()
74 spamActive = not spamActive
75 Button.Text = spamActive and "Auto Punch β
" or "Auto Punch"
76
77 if spamActive then
78 startSpam()
79 end
80end)
81
82local function stopSpam()
83 if spamLoop then
84 spamLoop:Disconnect()
85 spamLoop = nil
86 end
87end
88
89RunService.Heartbeat:Connect(function()
90 if not spamActive then
91 stopSpam()
92 end
93end)