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

How can i fix "A script has been running for a long time, and may be hanging."?

I was trying to make animated NPC (the animated custom rig) and when i was testing the error were showing up: "A script has been running for a long time, and may be hanging." After i press kill script the game continues playing and the script was working. But how can i make it not to appear again? (Script i used)

wait(3)

local hum = script.Parent.Humanoid
local anim = hum:LoadAnimation(script.Parent.Animation)

anim:Play()

while true do
anim:AdjustSpeed(0.21)
local hum = script.Parent.Humanoid
local anim = hum:LoadAnimation(script.Parent.Animation)
end

1 answer

✓ Accepted answer
wait(3)

local hum = script.Parent.Humanoid
local anim = hum:LoadAnimation(script.Parent.Animation)

anim:Play()

while true do
anim:AdjustSpeed(0.21)
local hum = script.Parent.Humanoid
local anim = hum:LoadAnimation(script.Parent.Animation)
wait(5) --add a wait
end

1 comment

0

yeah, the power of waits.

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