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:
local enable = true local player = game.Players.LocalPlayer local anime = script:WaitForChild('Animation') script.Parent.MouseButton1Click:connect(function() if enable == true then enable = false local animationTrack = player.Character.Humanoid:LoadAnimation(anime) -- doesn't work wait(2) enable = true end end)
I'm not sure what is wrong... and here's what the output is telling me:
20:02:33.440 - Infinite yield possible on 'Players.Lukeisbossman64.PlayerGui.list.scrolly.wave.LocalScript:WaitForChild("Animation")' 20:02:33.442 - Stack Begin 20:02:33.443 - Script 'Players.Lukeisbossman64.PlayerGui.list.scrolly.wave.LocalScript', Line 3 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?
Ref<Instance> WaitForChild ( string childName, double timeOut )
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:
local brick = nil 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