Hiya! I'm having some trouble with a script...it's a problem I've encountered in the past but I was never able to figure it out. Take a look:
01 | local enable = true |
02 | local player = game.Players.LocalPlayer |
03 | local anime = script:WaitForChild( 'Animation' ) |
04 | script.Parent.MouseButton 1 Click:connect( function () |
05 | if enable = = true then |
06 | enable = false |
07 | local animationTrack = player.Character.Humanoid:LoadAnimation(anime) -- doesn't work |
08 | wait( 2 ) |
09 | enable = true |
10 | end |
11 | end ) |
I'm not sure what is wrong... and here's what the output is telling me:
1 | 20 : 02 : 33.440 - Infinite yield possible on 'Players.Lukeisbossman64.PlayerGui.list.scrolly.wave.LocalScript:WaitForChild("Animation")' |
2 | 20 : 02 : 33.442 - Stack Begin |
3 | 20 : 02 : 33.443 - Script 'Players.Lukeisbossman64.PlayerGui.list.scrolly.wave.LocalScript' , Line 3 |
4 | 20 : 02 : 33.443 - Stack End |
I tried taking the WaitForChild thing out in the 3rd line on the script, but the output said that it couldn't find it as a child(not enough time to load.) So... this has left me confused. Any Help?
1 | Ref<Instance> WaitForChild ( |
2 | string childName, |
3 | double timeOut |
4 | ) |
Since you haven't specified a timeout, the current thread yields (think "the script halts") until the child is found. If the child is never found, then the script can never run; this would interfere with roblox's scheduler, in all likelihood.
Infinite yield = Stopped forever
http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild
Description: An infinite yield possible means that you are using WaitForChild() and it is possible that it will take forever to Find the item
Example:
1 | local brick = nil |
2 | workspace:WaitForChild(brick) |
Because the brick is false and not there, it will say infinite yield possible...
How to fix: To fix this you may wanna try finding WaitForChild() in your code and you may want to alter what is in the parenthesis... To make sure it doesn't say "Infinite yield......" fix the anime variable
I hope this helped, bye