I wrote this script to create a GUI when the game starts, and when the game starts, in the explorer the GUI is created but it does not show up.
function createLoadingGui()
newGUI = Instance.new("ScreenGui")
newGUI.Parent = game.StarterGui
newGUI.Name = "LoadingGui"
print("LoadingGui created successfully")
newFRAME = Instance.new("Frame")
newFRAME.Parent = game.StarterGui.LoadingGui
newFRAME.Name = "LoadingFrame"
print("LoadingFrame created successfully")
newTEXTLABEL = Instance.new("TextLabel")
newTEXTLABEL.Parent = game.StarterGui.LoadingGui.LoadingFrame
newTEXTLABEL.Name = "LoadingTEXTLABEL"
print("LoadingTEXTLABEL created successfully")
print("Function ran successfully")
end
game.Players.PlayerAdded:connect(createLoadingGui)

2 comments
Thanks! Why do I need to go "game:GetService" instead of just doing something like game.Players:ChildAdded/PlayerAdded and why do I need to put local infront of the variables? Sorry, I new at scripting.
You don't have to put local infront of them, but it's reccommended because they are used inside of a function. Same with GetService, you don't have to but it's highly recommended.