Hey guys! I’m attempting to find a gui in all player’s “PlayerGui”. But I have a question. Is this WaitForChild() necessary? I don’t want unnecessary stuff in my code, but I’m not sure if I need this WaitForChild() though.
function Functions.StartWave(WaveNumber, AU)
if AU.Value then
local Universe = AU.Value
local Wave = Universe:WaitForChild("Wave "..WaveNumber, math.huge)
for i, Player in ipairs(Players:GetPlayers()) do
local PlayerGui = Player:WaitForChild("PlayerGui", math.huge)
local Gui = PlayerGui:WaitForChild("Wave Gui", math.huge) -- Remove the waitforchild()? or keep it?
end
end
end
Depends when the function is run. Im guessing it probably runs when a player joins so its necessary cause the PlayerGui may not be rendered fast enough and before the function so it would just error and mess up the whole script
Edit: Also when it comes to little changes like that its best to leave it as is if it works
Okay, smart. Thanks everyone! I wish I could give you all the solution box for your help, but only one person can be chosen
Okay, so, I made a poll. Who do you think had the best answer?