LoadCharacter doesn't reset Guis immediately

The resetting is delayed for some reason, so if you add Gui to a newly loaded character, they will fail to get the Gui as it is removed after the delay is over. This causes some unexpected behavior, and some very hard to find bugs.

Edit: only in Start Server and ingame, PlaySolo seems to do alright with it.

This is because loading the character requires a request to the server which requires time. After the time has elapsed the PlayerGui is cleared and the new ones should be added.

local characterAddedHookup
characterAddedHookup = player.CharacterAdded:connect(function (char)
    gui.Parent = player:WaitForChild'PlayerGui'
    characterAddedHookup:disconnect()
end)
player:LoadCharacter()

I could do that, but it’s much much easier the way I have the game organized to work not using a CharacterAdded connection. This is also called from the server, so it should be super simple for it to clear the Gui on loading of the character (It can make the requests, but change the local instance like every other function, I’m sure)

And in the worst case scenario, make it yield for 2 ms