local plr = game:GetService("Players").LocalPlayer
local rs = game:GetService("ReplicatedStorage")
local char = plr.Character or plr.CharacterAdded:Wait()
local root = char:WaitForChild("HumanoidRootPart")
local r = rs:WaitForChild("remotes")
local onhit, swing = r.onHit, r.swing
local range, dmg, idk, delay = 250, 100, 1, 1
while task.wait(delay) do
if not root.Parent then
char = plr.Character or plr.CharacterAdded:Wait()
root = char:WaitForChild("HumanoidRootPart")
end
swing:FireServer()
for _, m in ipairs(workspace:GetChildren()) do
local hum = m:IsA("Model") and m:FindFirstChildOfClass("Humanoid")
local hrp = hum and m:FindFirstChild("HumanoidRootPart")
if hum and hrp and hum.Health > 0
and (root.Position - hrp.Position).Magnitude <= range then
onhit:FireServer(hum, dmg, {}, idk)
end
end
end
while true do
task.wait()
game:GetService("ReplicatedStorage"):WaitForChild("remotes"):WaitForChild("swing"):FireServer()
endNo comments yet. Be the first to comment!
1local plr = game:GetService("Players").LocalPlayer
2local rs = game:GetService("ReplicatedStorage")
3local char = plr.Character or plr.CharacterAdded:Wait()
4local root = char:WaitForChild("HumanoidRootPart")
5local r = rs:WaitForChild("remotes")
6local onhit, swing = r.onHit, r.swing
7local range, dmg, idk, delay = 250, 100, 1, 1
8while task.wait(delay) do
9 if not root.Parent then
10 char = plr.Character or plr.CharacterAdded:Wait()
11 root = char:WaitForChild("HumanoidRootPart")
12 end
13 swing:FireServer()
14 for _, m in ipairs(workspace:GetChildren()) do
15 local hum = m:IsA("Model") and m:FindFirstChildOfClass("Humanoid")
16 local hrp = hum and m:FindFirstChild("HumanoidRootPart")
17 if hum and hrp and hum.Health > 0
18 and (root.Position - hrp.Position).Magnitude <= range then
19 onhit:FireServer(hum, dmg, {}, idk)
20 end
21 end
22end
23
24while true do
25task.wait()
26game:GetService("ReplicatedStorage"):WaitForChild("remotes"):WaitForChild("swing"):FireServer()
27end