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)

2 comments
Please code block your code. To do so, highlight your code then press the blue Lua button (It's near Bold, Italic, etc). Or press the code block button then paste your code within.
thanks, ill edit it