Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with Character Loading?

I'm trying to stop the character spawning until after the intro GUI. I found this on the wiki and I removed what's on line 19 assuming the player wouldn't spawn when joining. But the player does? Can anyone help me disable character spawning?

Note: I'll make the character spawn using the script in the intro screen.

local respawnTime = 5
 
local Players = Game:GetService("Players")
Players.CharacterAutoLoads = false
 
Players.PlayerAdded:connect(function(Player)
	Player.CharacterAdded:connect(function(Character)
		-- find the humanoid, and detect when it dies
		local Humanoid = Character:FindFirstChild("Humanoid")
		if Humanoid then
			Humanoid.Died:connect(function()
				-- delay, then respawn the character
				wait(respawnTime)
				Player:LoadCharacter()
			end)
		end
	end)
 
	Player:LoadCharacter() -- load the character for the first time
end)

1 answer

This is pretty simple. Inside the IntroGui script, put this when the IntroGui ends:

local player = script.Parent.Parent.Parent.Parent -- parent 1 = frame, parent 2 = screengui, etc. you do not need this if you already have a player variable

player:LoadCharacter()

Yes, it´s as simple as that!

2 comments

0

I mean, the script sent does not work. The character loads when its not meant to.

0

Oh, in that case, remove line 19 of your script. But, your intro gui has to be initiated via script in Workspace, for guis do not load without a character.

This discussion is preserved as it was. New answers, comments, and votes are closed.