Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make an NPC do an emote?

Asked by 5 years ago

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!

0
Does your code generate any errors? cailir 284 — 5y
0
No it doesn't. soccervr -3 — 5y

2 answers

Log in to vote
0
Answered by
rabbi99 714 Moderation Voter
5 years ago
Edited 5 years ago
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()
Ad
Log in to vote
0
Answered by 5 years ago

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.

Answer this question