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

Why wont this animation script work?

I put this in a simple NPC it has a HumanoidRootPart and everything why wont it work?

local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=392699385" 

local animController = Instance.new("AnimationController")
local animTrack = animController:LoadAnimation(animation)

animTrack:Play()

it is in a local script.

1 answer

✓ Accepted answer

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		local findanimate = character:FindFirstChild("Animate")
		findanimate:WaitForChild("walk"):WaitForChild("WalkAnim").AnimationId = 'http://www.roblox.com/asset/?id=392699385'
		wait(1)
		
	end)
end)

That's what I have for my game. It's for a player joining the game though. I changed the anim id to yours. You will have to change the script so it works into a NPC. So probably something like this A local script runs on the client. A normal script runs on the server. So you might want it to run on a server. If the following code doesn't help, try putting the original code into a normal script and see if that helps.

local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=392699385"

Assuming you have the NPC walking around already, all you really need to do is just change the animation id. That's not really going to help though. May I see the entire script please?

2 comments

0

Ok thanks i figured the rest out on my own, thanks for the help!

0

You're welcome!

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