I am not sure why this is the case. I do not see why the character should have to exist for (supposedly?) replication to start occuring from StarterGui to PlayerGui.
It’s not a big bother, obviously, but my use case is using some menus from PlayerGui to customise a player’s character, and the character does not need to exist prior to customisation.
Not sure if this is a bug, so I didn’t post it in the bugs section. If someone could clear this up, I’d be happy to close this thread as is.
Repro attached below, if needed
bad_yield.rbxl (45.7 KB)
PlayerGui objects get replicated after loading the character.
You can fix this by manually cloning items from StarterGui to the PlayerGui.
Or simply load the character Player:LoadCharacter()
You’re completely right. I should’ve read the wiki page for PlayerGui first. I was so frustrated with this nonsensical behaviour I forgot to do that.
When the player’s Player.Character spawns for the first time all of the contents of StarterGui are automatically copied into the player’s PlayerGui. Note that if Players.CharacterAutoLoads is set to false the character will not spawn and StarterGui contents will not be copied until Player:LoadCharacter() is called.
This still doesn’t make sense to me, but thank you for your response.
I’m not sure why but the Starter GUI is not cloned to the player until the character loads. I’m assuming this is for compatibility reasons. A work around is to put the GUI in a server script in ServerScriptService
and put these contents:
local Players = game:FindService("Players")
local Gui = script:GetChildren()
Players.PlayerAdded:Connect(function(player)
for _, clone in Gui do
clone:Clone().Parent = player.PlayerGui
end
end)
(excuse my formatting, I wrote this here with lack of a tab key)