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?
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
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)