--// Services
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")
local TweenService = game:GetService("TweenService")
--// Variables
local plr = Players.LocalPlayer
local EggsFolder = Workspace:WaitForChild("Eggs")
local GameClient = ReplicatedStorage:WaitForChild("GameClient")
local PetsFolder = GameClient:WaitForChild("Pets")
local ClonesFolder = GameClient:WaitForChild("Clones")
--// UI Variables
local PlayerGui = plr:WaitForChild("PlayerGui")
This seems a bit weird for some reason it says.
Infinite yield possible on âPlayers.FelixProfit.PlayerGui:WaitForChild(âMainUIâ)â
If your code works, then you are good. The infinite yield shows up depending on how long it takes you to load into your game, if you load into it quick then it probably wonât show up, if there is lag or it is super slow, it will probably throw that warning. But then after your character loads in it fixes itself. As long as the code works of course, which I would guess so given that you said it happens only sometimes.
You can prevent that by utilizing the second argument in WaitForChild which is how long you want it to wait in seconds until it returns ânilâ if it didnât find the object.
I get that warning all the time if my game takes longer to load, the warning just pops up because it thinks that the thing isnât there, when really it just needed a little more time to wait.