Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with Character Loading?

Asked by
Zyleak 70
9 years ago

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

Log in to vote
0
Answered by 9 years ago

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!

0
I mean, the script sent does not work. The character loads when its not meant to. Zyleak 70 — 9y
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. TheDeadlyPanther 2460 — 9y
Ad

Answer this question