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?
So like you need to get the position of the police spawnpoint and copy it and paste it in the moveto Example
Humanoid:MoveTo(12,5,-16)
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 = Player.Character.Humanoid:MoveTo(postion) end)