I am trying to make a start screen. I have made it so you change teams, but when I click continue I need to respawn the character so it will spawn in the designated area. The problem is, I keep getting this error: 19:07:15.090 - ServerScriptService.CloseStarterGui:2: attempt to index nil with 'LoadCharacter'
My Local Script code:
local button = script.Parent
local cont = false
local function onButtonActivated()
if game.Players.LocalPlayer.TeamColor ~= BrickColor.new("Really black") then
if cont == false then
cont = true
wait(.1)
game.ReplicatedStorage.CloseStarterGui:FireServer()
script.Parent.Parent.Enabled = false
else
warn("Stop spamming continue!") --to make sure the script isn't run more than once
end
else
if script.Parent.Parent.ImageLabel.ChooseATeam.Visible == false then --If they didn't choose a team it will tell them to choose one.
script.Parent.Parent.ImageLabel.ChooseATeam.Visible = true
wait(1)
script.Parent.Parent.ImageLabel.ChooseATeam.Visible = false
end
end
end
button.MouseButton1Click:Connect(onButtonActivated) --to activate the script
My Server script's code (In ServerScriptService):
game.ReplicatedStorage.CloseStarterGui.OnServerEvent:Connect(function()
game.Players.LocalPlayer:LoadCharacter() --If I am not mistaking, you need to load the character in a normal Script (not a LocalScript)
end)
The reason I am trying to use LoadCharacter instead of setting the player's health to 0 is I am also using ACS, so when someone clicks continue their screen would go black with blood marks on the sides. (not what I want to happen when they click continue (play). Please help.

1 comment
Thank you.