So I made a working loading screen and a menu GUI, however I don’t know how to make the menu appear after the player loads in. I tried to use wait() but it would vary because of when different players load in. What’s the script for it ?
1 Like
Localscripts run when the player is in the game. If you are checking for the character you can simply use
local Character = Player.Character or Player.CharacterAdded:Wait() -- Waits for the character to be added
script.Parent.Frame.Visible = true
2 Likes
This approach freezes the whole script and any code after the Player.CharacterAdded:Wait()
will not run until the character is added. It is fine if the GUI appearing has its own script, however if making the GUI appear is integrated into another script from which you want other things to run as well, you could connect to the PlayerAdded
function, which will fire when a player joins. A way you could do this is:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.PlayerGui.[...].Visible = true
end)
This can be run from a script on the server.
2 Likes