How to prevent character from spawning into world while showing GUI

  1. What do you want to achieve?
    I have a character customization dialog that I want to show BEFORE the character spawns/loads into the game. Once in my game, a player can be killed so I need the player to not spawn until they have customized and picked their character via my dialog/GUI.

  2. What is the issue?
    Client GUI does not load and cannot be cloned until character is loaded (which spawns player in the game)

  3. What solutions have you tried so far?
    I tried this strategy:

  • Set game.Players.CharacterAutoLoads = false.
  • When client connects, fire an event from server to have the client show the customize character dialog.

However, I discovered local scripts are not loaded until the server calls LoadCharacter().

Thus, I can think of no way to show GUI for the client unless the client spawns in the game first.

5 Likes

You can spawn the character in a zone out of sight where the players there don’t have the ability to move or attack. Alternatively, you could spawn them in the map and surround the player in a forcefield or any other way of protection so that the player can’t be attacked by other players whilst still in the character customization menu

Actually I think I finally discovered how to do this.

Since I can’t clone the GUI on the client, I instead clone it on the server.

Example:

local gui = player:WaitForChild("PlayerGui")
local characterSelectionDialog = game.StarterGui.CharacterSelection:clone()
    characterSelectionDialog.Parent = gui

I am currently testing it out…

3 Likes

So it works well to have the server clone the GUI for the player before they enter the game.

There are a number of quirks to work around. Would be nice to know everything that LoadCharacter does. Does anyone have the list of things LoadCharacter() does?

One example: I had to disable then re-enable Animate script for animation to work.