Check if player has fully loaded, and everything is good

So, I’ve made gui’s and guis for my tool in my game, but the problem is, if the player is not fully loaded and the player attempts to use the guis the scripts break. What is the best possible way to check if everything in the player has loaded?

The game bedwars uses something like this, because the hot bar doesn’t load until the player is completely loaded with everything. ( not so sure how bedwars developers did that)

Any help would be greatly appreciated!

You should use WaitForChild() which works for almost any instance -

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")

local loadedGui = PlayerGui:WaitForChild("gui that you want to find.")
3 Likes

Yea, I always use wait for child but the problem is sometimes it says infinite yield, which then breaks the script

1 Like

You can put a script in ReplicatedFirst which could have a

 if game:IsLoaded() then
––activate scripts in the player or character 
else
repeat
game:IsLoaded()
until game:IsLoaded()
––activate scripts in the player or character 
end

Or youu could use

local player = game.Players.LocalPlayer
local Char = player.Character or player.CharacterAdded:Wait()

Both would have same reaction just that the first one would be my choice personally as you would be more sure when the client has loaded the important stuff first and not just rely on the character.

The way most people use is

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

So it waits for the character to fully spawn into the Workspace, hope this helps!

4 Likes

This is the way I go for my localscripts, haven’t had any issue at all with this method.