01 | local startergui = game.StarterGui |
02 |
03 | script.Parent.MouseButton 1 Click:Connect( function () |
04 | script.Parent.Parent.Parent:Destroy() |
05 | game.StarterGui:WaitForChild( "MotherViewPrison" , 1 ):Destroy() |
06 | game.StarterGui:WaitForChild( "Prisoners" , 1 ):Destroy() |
07 | game.Players.LocalPlayer.Team = game.Teams.Police |
08 | game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid |
09 | game.Workspace.CurrentCamera.CameraType = "Custom" |
10 | end ) |
Even when the player dies, it doesn't load at the Team Spawn
Maybe try:
1 | local plr = sceipt.Parent.Parent.Parent.Parent.Parent.Name |
2 |
3 | script.Parent.MouseButton 1 Click:connect( function () |
4 | game.Players [ plr ] .BrickColor = BrickColor.new( "Color" ) -- Put the color of your team in there |
5 |
6 | game.Players.LocalPlayer.Character.Humanoid.Health = 0 |
One thing that might not work in the script is from lines 5 and 6 I know this isn’t really the answer to your question but it’s one of the answers to fixing your script. If the script is locally I’d suggest you not use StarterGui as that won’t do anything you would rather do.
1 | game.Players.LocalPlayer.PlayerGui |
2 |
3 | -- Instead of game.StarterGui |
So switch out lines 5 and 6 for
1 | -- Line 5 |
2 | game.Players.LocalPlayer.PlayerGui:WaitForChild( "MotherViewPrison" , 1 ):Destroy() |
3 | -- Line 6 |
4 | game.Players.LocalPlayer.PlayerGui:WaitForChild( "Prisoners" , 1 ):Destroy() |
01 | local player = game.Players.LocalPlayer |
02 |
03 | script.Parent.MouseButton 1 Click:Connect( function () |
04 | script.Parent.Parent.Parent:Destroy() |
05 | player.PlayerGui:WaitForChild( "MotherViewPrison" , 1 ):Destroy() |
06 | player.PlayerGui:WaitForChild( "Prisoners" , 1 ):Destroy() |
07 |
08 | -- The team changing line I removed it because you would need RemoteEvents to change the player’s team or else nobody will see the player being on the police team and the script won’t work so consider learning RemoteEvents/RemoteFunctions |
09 |
10 | -- Link To RemoteEvent And FE Stuff: |
12 |
13 | player:LoadCharacter() -- Insta Respawns The Player |
14 | end ) |