Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How could I make an animation play when a player clicks a part?

I've tried doing this before when a player clicks a part but I don't understand how. I also tried making a script where an animation will play when a player clicks with a tool but it failed as well. On the wiki it says LoadAnimation is deprecated? How would I do this?

1 answer

✓ Accepted answer

Firstly, put a Script and ClickDetector in the part then, inside the script type:

script.Parent.ClickDetector.MouseClicked:Connect(function()
-- [ this is just a example of how to load the animation ]
local animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
-- [ this is just a example of how to load the animation ]
end)

Sorry for the bad formatting on mobile

3 comments

0

Tho this is not a tool. it’s a part button

0

Hey! Thank you, would that need to be a local script? Do I just insert the animation into the part I want or does it matter?

0

I haven’t figured that out yet :(. But I bet you can :)

This discussion is preserved as it was. New answers, comments, and votes are closed.