Make a Npc animation like in bee simulator

Hi, I’m a beginner scripter and I am not that good at scripting.

I want to make a Npc like the Bears in Bee simulator so they can sometimes wave and also play an idle.
I couldn’t figure out how it could be done so I need help to understand how I can do it.
I hope it’s clear for people Ty :blush:

There are many tutorials, just search on google and you will find many. But the general gist of it is to make insert an animation into your game, set the ID to the one you want, and then use a script like this to play the animation:

local humanoid = --reference the NPC humanoid here
local animation = --wherever you put the animation, reference it here
local loadedAnim = humanoid:LoadAnimation(animation)
loadedAnim:Play() -- to play the animation
loadedAnim:Stop() -- to stop animation

Hope this helps, ask me if you need anything else.

1 Like

Maybe like this?

local anim = -- anim
local loadedanim -- loaded anim

while true do
	loadedanim:Play()
	wait(put anything)
end
2 Likes

Hi! Thanks for responding but that is the part i already know. I want to know how i can make the npc wave sometimes like an random action similar like the bears from bee swam simulator.

Then you would do something similar to whhat coolif_y said. If you want it to be random and not at a set interval, you can use math.random(1, 10). This would generate a random number between 1 and 10. You can change these numbers if you want a different range of numbers to use. You would put this in the wait, like so.

local anim = --animation
local loadedAnim = --loaded animation
local startNum = --put whatever number here
local endNum = --put the second number that you want here
while wait(math.random(startNum, endNum)) do
  loadedAnim:Play()
end
1 Like

Thank you for replying i will test it out

thank you very much it worked how i wanted it to be :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.