I am trying to make an NPC that has a typing animation. No, I am not making a custom animations-type thing. I want to make the animation loop, when the game starts. Just a single animation. I looked over the wiki and couldnt find anything (yes, I tried the Animations section. Didnt work). The animation is: https://www.roblox.com/typing-item?id=420291785 . I cannot seem to find the issue. Do I need a script to start it, or where would I put the animation?
COMMUNITY QUESTION
Using single animations?
2 answers
I am assuming here that your NPC is pretty close to a player, is in workspace, and has a humanoid. I think this may work :D
NPC = workspace.NPC
repeat wait() until NPC ~= nil
local human = NPC:WaitForChild("Humanoid")
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=420291785"
local animControl = Instance.new("AnimationController")
local animTrack = animControl:LoadAnimation(anim)
while true do
animTrack:Play()
wait(animTrack.Length)
end
1 comment
0
Nope. Didnt work for me. There were no errors in the log, but the animation just did not run.
I made this quick little thing, hope this works. Place this script in the NPC and place the animation in the script like for example "NPC.Script.Animation"
function PlayAnimation()
local Humanoid = script.Parent:WaitForChild('Humanoid') -- Waits for humanoid in the NPC
local Animation = Humanoid:LoadAnimation(script.Animation) -- name Animation to what you named your animation.
wait(.3)
Animation:Play() -- Plays your animation
end
game.Players.PlayerAdded:connect(PlayAnimation)
2 comments
0
Still didn't work :/
0
Weird, I used this script and it works 100% for me.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Did you make the animation?
^ hes the owner of the animation
also what is even your problem? you just say you want the animation to loop but i dont know what your problem is
It just does not work. The animation never starts. How would i make the animation start (I have it set to loop) when the game starts?