I'm attempting to create a script that makes my NPC animate randomly. However, it only animates once.
1 | local hum = script.Parent:WaitForChild( "Humanoid" ) |
2 | local Anim 1 = hum:LoadAnimation(script:FindFirstChild( "Animation1" )) |
3 |
4 | for i = 1 , 5 do |
5 | Anim 1 :Play() |
6 | Anim 1. Looped = false |
7 | print (math.random( 5 , 10 )) |
8 | end |
FIXED:
1 | local hum = script.Parent:WaitForChild( "Humanoid" ) |
2 | local Anim 1 = hum:LoadAnimation(script:FindFirstChild( "Animation1" )) |
3 |
4 | while true do |
5 | local test = math.random( 1 , 10 ) |
6 | print (test) |
7 | Anim 1 :Play() |
8 | wait( 5 ) |
9 | end |