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

Why isn't my local script working for my animation in a tool?

Asked by 6 years ago

So, I made some gymnastics animations, and I put it into a tool so that when you equip the tool and click anymore with the mouse, it plays the animation. It works perfectly on Roblox Studio. But, when I go to play it on my game, it doesn't work at all. Is it because of filtering enabled, or what? I'm confused. What am I doing wrong?

Tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")

local animation = Tool.Handstand --Change DanceAnim to the name of your animation.
local AnimTrack = hum:LoadAnimation(animation) --Loads the animation into the humanoid.

Tool.Activated:connect(function(mouse) --If you're using a tool, change Selected to Activated, and get rid of the code on the next line. Otherwise, keep this the same.
    AnimTrack:Play()
    end)
AnimTrack.Priority = Enum.AnimationPriority.Action

Tool.Unequipped:connect(function() --If you're using a tool, change Deselected to Unequipped. Otherwise keep it the same.
    AnimTrack:Stop()
end)

*This is a repost as I haven't gotten any answers. PLEASE HELP!

Answer this question