Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can Someone help me fix my sword? Its Saving Damage

Asked by 5 years ago

so the problem is that it saves the click so i can click the sword and 30 seconds later touch the humanoid and it takes damage i dont know how to fix it

    IsTouching = false
    CanDamage = script.Parent.CanDamage.Value


script.Parent.Activated:connect(function()

    CanDamage = true

script.Parent.blade.Touched:connect(function(p)

    IsTouching = true

if IsTouching == true and CanDamage == true then

    print("CanDamage has been verified")

    print("Can Damage has been sent to false")
    CanDamage = false
    p.Parent.Humanoid:TakeDamage(20)
    print("The Player has taken damage")


        end

end)

script.Parent.blade.TouchEnded:connect(function()
    IsTouching = false

end)

end)

0
Just so you know, CanDamage is not a reference to the Value property of your CanDamage BoolValue. It will not update if the Value changes either. User#24403 69 — 5y
0
ok so why is it working then and how would we get it to update it, also do you know how we would get it to stop holding onto damage. Toadly_Ethan 0 — 5y
0
Because the touched event is working, you can’t have the CanDamage value equal itself. To update it you could use a Changed or GetPropertyChangedSignal ABK2017 406 — 5y

Answer this question