I'm trying to run a check on whether something exists or not and to solve the problem automatically in case of random glitches. I usually do this by checking whether a value is nil or not, but since it comes out as an infinite yield, I need a new way to check if the yield is infinite. what is the alternative for | if == nil then | to check if for an infinite yield instead
here's the code btw
if game.ServerStorage.maps:WaitForChild("friendship_park") == nil then
if game.ServerStorage:FindFirstChild("friendship_park") == nil then
local map_1 = game.Workspace.friendship_park
map_1.Parent = game.serverstorage.maps
else
local map_1 = game.Workspace.MapHolder.friendship_park:Clone()
map_1.Parent = game.ServerStorage.maps
end
end
the output is
11:57:45.382 - Infinite yield possible on 'ServerStorage.maps:WaitForChild("friendship_park")' 11:57:45.384 - Stack Begin 11:57:45.385 - Script 'ServerScriptService.mainscript', Line 125 11:57:45.386 - Stack End

1 comment
WaitForChild has a second optional argument which it the time to wait