I have a Gui button that when activated the player respawns at the teams spawn. Instead, it throws a bunch of errors and the script does not work. Heres the code:
local Confirm = game.Players.LocalPlayer:FindFirstChild("PlayerGui"):FindFirstChild("Team Selector").Confirmation
local Player = game.Players.LocalPlayer
local Police = game:GetService("Teams"):FindFirstChild("Police")
local GUI = script.Parent
local PoliceSpawn = game.Workspace("Police Station").Spawns.Police
GUI.Activated:connect(function()
Confirm.Visible = true
Player.Team = Police
game.Players.LocalPlayer.Character.Humanoid.Health = 0
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = PoliceSpawn.CFrame + Vector3.new(0,5,0)
end)
Its a big script. but is doesn't work. Can someone help me?

1 comment
This does not make sense