So basically whenever you hit the player you can keep on clicking the weapon which deals damage, I want it so you can only deal the damage 1 time if the weapon is activated?
Any Ideas Why My Script Is Doing This?
server script in Tool
Av = script.Parent.DamageValue.Value --Attack Value
local CanDamage = script.Parent.CanDamage
tool = script.Parent
function tagHumanoid(humanoid,killer)
if humanoid and killer then
local tag = Instance.new("ObjectValue")
tag.Name = "Killer"
tag.Value = killer
tag.Parent = humanoid
end
end
script.Parent.Activated:Connect(function()
CanDamage.Value = true
if script.Parent.Handle.Touched then
script.Parent.Handle.Touched:Connect(function(p)
local plr = game.Players:GetPlayerFromCharacter(tool.Parent)
if script.Parent.CanDamage.Value == true and p.Parent:FindFirstChild("Humanoid") then
script.Parent.CanDamage.Value = false
local humanoid = p.Parent:FindFirstChild("Humanoid")
humanoid:TakeDamage(Av)
tagHumanoid(humanoid, plr)
wait(.2)
script.Parent.CanDamage.Value = true
if p.Parent.Humanoid.Health < 1 then
print("Player Has Died")
end
end
end)
end
end)

1 comment
There is only 1/5th of a second between each time being able to fire