So it makes the NPC Dance but it doesnt work in game..only on studio it works?
local animation = script.Animation local animController = script.Parent.AC local animTrack = animController:LoadAnimation(animation) animTrack:Play()
Are you using a Server Side script, or a Local Script? If your using a Server Side script, it's not going to work. Your referring to the player obviously, and the player is not exactly in the server, its on the local side, your side. If you put it in a Server Script(which is basically called a Script) it can't refer to it. It doesn't work in servers and only works in Studio because in Studio, its not running the game on the ROBLOX servers but on your computer. When you play in a normal server its running in the ROBLOX servers. That is why things work differently.
To fix it, change the script to a LocalScript.
Your welcome.
Whilst in studio the scripts load after all instances are loaded, on the server it loads before all instances, so it's fixed by simply adding a WaitForChild("")
WaitForChild("") is a pre-built function in all kind of Instances in roblox, wich waits for an Instance to load, being basically this:
function WaitForChild(part,ins) while (part:FindFirstChild(ins)==nil) do wait() end return ins end
So you only need to do this:
local animation = script:WaitForChild('Animation') local animController = script.Parent:WaitForChild('AC') local animTrack = animController:LoadAnimation(animation) animTrack:Play()