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

Why do I have this LoadCharacter() problem?

Asked by
Supint 60
9 years ago

The script's purpose is to control the visibility of different GUIs corresponding to the life and death of the humanoid. It is also supposed to control the humanoid respawn, but for some reason I can't use LoadCharacter() when FE is enabled?

Filtering Enabled is on, and this is in a Server Script.

local Players = game:GetService("Players")
Players.CharacterAutoLoads = false

game.Players.PlayerAdded:connect(function(Player)
    local gui = game.ReplicatedStorage.BeginGui:Clone()
    gui.Parent = Player.PlayerGui
    Player.CharacterAdded:connect(function(Character)
        local Humanoid = Character:FindFirstChild("Humanoid")
        if Humanoid then
            Humanoid.Died:connect(function()
                wait(1)
                Player:LoadCharacter(false)
                Player.PlayerGui.Shop.Base.Visible = true
                print("this")
            end)
        end
    end)
    Player:LoadCharacter(false)
    Player.PlayerGui:WaitForChild("Shop")
    Player.PlayerGui.Shop.Base.Visible = false
end)

Answer this question