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)
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.")
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.