So I made this tool called "Pipe" and it has animations that work properly but the damage on the pipe does not work. Ignore the part that's not about damage.
Here is the first set of code: script.Parent.PipeHit.Touched:connect(function() if script.Parent.CanDamage.Value == true then script.Parent.CanDamage.Value = false script.Parent.Humanoid:TakeDamage(15) wait(1.75) script.Parent.CanDamage.Value = true
end
end)
I have a value called "CanDamage".
Next script:
local CanAttack = true
script.Parent.Equipped:connect(function()
local PipePullOut = script.Parent.Parent.Humanoid:LoadAnimation(script.PipePullOut)
local PipeAttack = script.Parent.Parent.Humanoid:LoadAnimation(script.PipeAttack)
PipePullOut:Play()
script.Parent.Unequipped:connect(function(mouse)
PipePullOut:Stop()
end)
end)
script.Parent.Activated:connect(function()
local PipePullOut = script.Parent.Parent.Humanoid:LoadAnimation(script.PipePullOut)
local PipeAttack = script.Parent.Parent.Humanoid:LoadAnimation(script.PipeAttack)
if CanAttack == true then
PipeAttack:Play()
PipePullOut:Stop()
CanAttack = false
wait(0.65)
PipeAttack:Stop()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)
PipeAttack and PipePullOut are both Animations. Yes, I have a working Handle, and Yes, I have a part that serves as a hitbox to the pipe. Please Help!