Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
0
Answered by
SurfedZ 36
5 years ago
Edited 5 years ago

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

Ad

Answer this question