if script.Parent.CanDamage.Value == true then
if not touch.Parent:FindFirstChild("Humanoid") then return end
script.Parent.CanDamage.Value = false
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
touch.Parent.Humanoid:TakeDamage(plr.leaderstats.Power.Value)
if touch.Parent.Humanoid.Health < 1 then
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
plr.leaderstats.Kills.Value = plr.leaderstats.Kills.Value + 1
end
wait(1)
script.Parent.CanDamage.Value = true
end
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
script.Parent.Handle.Touched:Connect(function(touch)
if script.Parent.Parent:FindFirstChild("your tool name") then
if script.Parent.CanDamage.Value == true then
if not touch.Parent:FindFirstChild("Humanoid") then return end
script.Parent.CanDamage.Value = false
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
touch.Parent.Humanoid:TakeDamage(plr.leaderstats.Power.Value)
if touch.Parent.Humanoid.Health < 1 then
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
plr.leaderstats.Kills.Value = plr.leaderstats.Kills.Value + 1
end
wait(1)
script.Parent.CanDamage.Value = true
end
end
end)
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
script.Parent.Activated:Connect(function() -- On mouse click when equipped
for _, p in pairs(script.Parent.Handle:GetTouchingParts()) -- Go through all parts it's touching
if p.Parent:FindFirstChild("Humanoid") then -- If the player is hitting a HumanoidModel then
p.Parent.Humanoid:TakeDamage(plr.leaderstats.Power.Value) -- Damage humanoid
if touch.Parent.Humanoid.Health =< 0 then
plr.leaderstats.Kills.Value = plr.leaderstats.Kills.Value + 1 -- Add a kill
end
break -- so you dont accidently damage the same person multiple times or another person
end
end
end)