Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I'm having trouble with my CFrame respawn script. Whats the Error?

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 answer

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)

1 comment

0

This does not make sense

This discussion is preserved as it was. New answers, comments, and votes are closed.