I have dealt with something like this before and it does not work. The game doesn’t consider the gui objects existing until the PC loads it in, which isn’t instant. Weirdly scripts can run before Roblox is done making the games existing objects.
What I mean is like being able to identify the gui.
game:GetService("StarterGui"):WaitForChild("MenuSelect")
print("yoink")
local players = game:GetService("Players")
local localPlayerGui = players.LocalPlayer
task.wait(1)
players.PlayerAdded:Connect(function(player)
for _, ui in pairs(game.StarterGui:GetChildren()) do
local u = ui:Clone()
u.Parent = localPlayerGui
end
end)
That’s literally the same thing as replicating 3D stuffs such as parts in the game to the client. It takes time to load, Preload function was designed to force the client to load these instance first. Guis are also the same thing.
Apparently I’ve been working on server side too much. The problem was that the function would never get fired. Since when the client player loads into the game the server player has already been added. And since this is a local script, we don’t need to be checking when the player gets added. A revised script:
local player = game.Players.LocalPlayer
for _, ui in pairs(game.StarterGui:GetChildren()) do
local u = ui:Clone()
u.Parent = player.PlayerGui
end