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

How do I make my NPC animate randomly? [FIXED]

Asked by 4 years ago
Edited 4 years ago

I'm attempting to create a script that makes my NPC animate randomly. However, it only animates once.

local hum = script.Parent:WaitForChild("Humanoid")
local Anim1 = hum:LoadAnimation(script:FindFirstChild("Animation1"))

for i = 1, 5 do
    Anim1:Play()
    Anim1.Looped = false
    print(math.random(5,10))
end

FIXED:

local hum = script.Parent:WaitForChild("Humanoid")
local Anim1 = hum:LoadAnimation(script:FindFirstChild("Animation1"))

while true do
    local test = math.random(1,10)
    print(test)
    Anim1:Play()
    wait(5)
end

Answer this question