Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont the GUI load in game (it loads in studio)?

Both of the screen GUI's are located in Replicated Storage. Then I have a script in ServerScriptService, which clones the GUI's into the game after waiting for the PlayerGui. This works and loads in studio, but when I publish it and test it the screen gui won't load. I've tried many things but, as im a beginner I cant find a way to do it :P

local gui = game.ReplicatedStorage.StarterMenu

local menu = game.ReplicatedStorage.EggMenu

  

game.Players.PlayerAdded:connect(function(player)

player:WaitForChild("PlayerGui")

gui:Clone().Parent = player.PlayerGui

menu:Clone().Parent = player.PlayerGui

end)

1 answer

✓ Accepted answer

If your script is on ServerScriptService then you should wait until the ReplicatedStorage Instances load.

local gui = game.ReplicatedStorage:WaitForChild("StarterMenu")
local menu = game.ReplicatedStorage:WaitForChild("EggMenu")
game.Players.PlayerAdded:Connect(function(player)
    player:WaitForChild("PlayerGui")
    gui:Clone().Parent = player.PlayerGui
    menu:Clone().Parent = player.PlayerGui
end)

I hope this helps you

This discussion is preserved as it was. New answers, comments, and votes are closed.