hello once again i am asking for help. i am trying to get a custom animation to run when the player clicks a part so far i have not been able to get anything to work. could someone help me?
✓ ANSWER ACCEPTED
help with running animations by clicking a part in the workspace?
1 answer
✓ Accepted answer
Looks like you forgot the other " at the end of the AnimationId property string. Also, I would use the built-in property, "Character", which is automatically in the player.
workspace.Hello.ClickDetector.MouseClick:Connect(function(player)
local animation = Instance.new("Animation")
animation.AnimationId = “rbxassetid://04916278158"
local loadedAnimation = player.Character.Humanoid:LoadAnimation(animation)
loadedAnimation:Play()
end)
2 comments
0
thank you this worked but for some reason the animation plays 3 times
0
for anyone who was interested i solved with a wait() after the play
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Can you paste your script here?
game.Workspace.Hello.ClickDetector.MouseClick:Connect(function(Player) local animation = Instance.new(“Animation”) animation.AnimationId = “http://www.roblox.com/Asset?ID=04916278158 local loadedAnimation = game.Workspace[player.Name].Humanoid:LoadAnimation(animation) loadedAnimation:Play() end)
I made an answer. Check it out and try it.