I am trying to animate and watched a video about it, but for some reason the code works on a npc, but not on a player:
local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=1574345273" local trackanimation = nil local playability = true function playAnimation(AnimationSource) if playability == true then local plr = game.Players.LocalPlayer trackanimation = plr.Character:WaitForChild("Humanoid"):LoadAnimation(animation) trackanimation.KeyframeReached:Connect(function() print("Works") end) trackanimation:Play() print("play") end end script.Parent.MouseButton1Click:Connect(playAnimation)
It works on an NPC because it's in a ServerScript.
You probably need a LocalScript,
It's likely your animation is being overlapped by the movement animations that Roblox has put in place by default - circumvent this by going in the animation editor - going to "Edit" in the plugin, and then changing the animation priority to whatever the bottom one is - I believe it is movement, which is the highest level animation. After you set it to the highest level animation priority, reexport it to Roblox, overwriting your previous animation.
Let me know if this helps any. :)