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

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

Asked by
Zikelah 20
5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)

0
This does not make sense Zikelah 20 — 5y
Ad

Answer this question