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

Animation script for tool not working when equipped and clicked?

Asked by 6 years ago

I made an animation script for a cup, and When the player has the tool equipped, and the player clicks it plays the animation. But it doesnt work.

things to know -- Animis the name of the animation and it is inside the script. Tool is a cup. here is my script

local Tool = script.Parent
local Anim = nil
local Ready = true

Tool.Activated:Connect(function()
    if Tool.Parent.Humanoid.Health > 0 and Ready == true then
        Ready = false
        Anim = Tool.Parent.Humanoid:LoadAnimation(script:WaitForChild("Anim"))
        Anim:Play()
        wait(2)
        Ready = true
    end
end)

Tool.Unequipped:Connect(function()
    if Anim then Anim:Stop() end
    Ready = true
end)
0
Are there any errors? User#5423 17 — 6y

Answer this question