Hello. I have made a script which is meant to remove a house when a player leaves or types a command. I made this a function. This seems to work fine but whenever around 8 people start playing I get this error saying "Infinate yield possible on". This is really annoying because I know for a fact it's there and I keep getting these errors... Heres my script
function remove(booth) for i, child in ipairs(game.ReplicatedStorage.Information:GetChildren()) do if child:WaitForChild("Plot") then if child.Plot.Value == booth.Floor.Floor then child:Destroy() end end end end
This works sometimes????
My first guess is that its because you used ipairs which stops once it finds a nil arguement, and that you used WaitForChild instead of FindFirstChild.
function remove(booth) for i, child in pairs(game.ReplicatedStorage.Information:GetChildren()) do if child:FindFirstChild("Plot") then if child.Plot.Value == booth.Floor.Floor then child:Destroy() end end end end