I am currently working on a prison game and i have created a team select/change GUI. I have programmed a script that is meant to change the player's team and kill them so they spawn at that team spawn. It all works, the player respawns at the neutral spawnpoint, which is very frustrating. The player still remains in the chosen team. I have correctly paired up the teams to their spawnpoints by making the brick colours and team colours the same. They also have the same name. I have unchecked 'Neutral'. Here is the LocalScript:
Button = script.Parent
script.Parent.Parent.Visible = true -- opens the gui
Button.MouseButton1Down:connect(function(open)
script.Parent.Parent.Visible = false -- closes the gui
game.Players.LocalPlayer.Team = game.Teams.Policemen
game.Players.LocalPlayer.RespawnLocation = game.Workspace.Policemen
local plr = game.Players.LocalPlayer.name
local plrfound = game.Workspace:FindFirstChild(plr)
plrfound.Humanoid.Health = 0
end)
Please help me out Thanks

2 comments
i think not sure tho that on line 9 at the end add .Position
This doesn't work.