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

How do I make an NPC do an emote?

I have an Npc and connected it to a script and want it to do an emote after a few seconds here is the script.

local Guard = game.workspace.guard

wait(5)
Guard.Humanoid:PlayEmote("http://www.roblox.com/asset/?id=507770677")

But nothing is playing help needed!

2 comments

0

Does your code generate any errors?

0

No it doesn't.

2 answers

✓ Accepted answer
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=507770677"
wait(5)
local npc = script.Parent --npc is your humanoid
npc:LoadAnimation(anim):Play()

The reason it isn't working is because you need to do it a different way. First off, you don't want to have it play the animation by using "http://www.roblox.com/asset/?id=507770677". You want to make an animation, name it 'Guard', set "http://www.roblox.com/asset/?id=507770677" as the AnimationId, and put the animation in the script. Then you should use this:

local animation = script:WaitForChild('Guard')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:Play()

That should make the NPC play the animation over and over. If you want to make it wait everytime before it plays the animation, the easiest way is to do it in the animation. For example, a wave. You can animate it so the person waves, then goes back to standing still, and just have them standing still for 5 seconds before the animation repeats.

This is tested and it worked for me, so yeah.

Ben.

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