local startergui = game.StarterGui script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent:Destroy() game.StarterGui:WaitForChild("MotherViewPrison",1):Destroy() game.StarterGui:WaitForChild("Prisoners", 1):Destroy() game.Players.LocalPlayer.Team = game.Teams.Police game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Custom" end)
Even when the player dies, it doesn't load at the Team Spawn
Maybe try:
local plr = sceipt.Parent.Parent.Parent.Parent.Parent.Name script.Parent.MouseButton1Click:connect(function() game.Players[plr].BrickColor = BrickColor.new("Color") -- Put the color of your team in there 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.
game.Players.LocalPlayer.PlayerGui -- Instead of game.StarterGui
So switch out lines 5 and 6 for
-- Line 5 game.Players.LocalPlayer.PlayerGui:WaitForChild("MotherViewPrison",1):Destroy() -- Line 6 game.Players.LocalPlayer.PlayerGui:WaitForChild("Prisoners", 1):Destroy()
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent:Destroy() player.PlayerGui:WaitForChild("MotherViewPrison",1):Destroy() player.PlayerGui:WaitForChild("Prisoners", 1):Destroy() -- 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 -- Link To RemoteEvent And FE Stuff: https://developer.roblox.com/api-reference/class/RemoteEvent player:LoadCharacter() -- Insta Respawns The Player end)