So, I have a system where when a player is killed, and they are hostile, they go to jail. However, it wont teleport them to the jail.
function charAdd() print("respawn") local char = script.Parent.Parent.Character if script.Parent.Parent.TeamColor == BrickColor.new("Bright orange") then script.Parent.Parent.Neutral = false char:MoveTo(game.Workspace.PrisonBlock.Position + Vector3.new(0,1,0)) print("waiting") wait(script.Parent.Parent.leaderstats.JailTime.Value) script.Parent.Parent.TeamColor = BrickColor.new("White") script.Parent.Parent.Neutral = true print("out of jail") script.Parent.Parent.leaderstats.JailTime.Value = 0 char.Humanoid.Health = 0 end end script.Parent.Parent.CharacterAdded:Connect(charAdd)
I've never seen anyone use MoveTo to teleport a player. Use CFrame though.
function charAdd() print("respawn") local char = script.Parent.Parent.Character if script.Parent.Parent.TeamColor == BrickColor.new("Bright orange") then script.Parent.Parent.Neutral = false char:WaitForChild("HumanoidRootPart").CFrame = game.Workspace.PrisonBlock.CFrame print("waiting") wait(script.Parent.Parent.leaderstats.JailTime.Value) script.Parent.Parent.TeamColor = BrickColor.new("White") script.Parent.Parent.Neutral = true print("out of jail") script.Parent.Parent.leaderstats.JailTime.Value = 0 char.Humanoid.Health = 0 end end script.Parent.Parent.CharacterAdded:Connect(charAdd)