I am new to scripting and I have been trying to find an answer to this question but nothing that works has come up. I have 3 teams named Maroons, Deep Oranges and Lobby. I am wanting to make a game where the player from the Maroons team has to touch a block and then the block which is called EndBlock will change all players teams back to Lobby, kill them and then display a gui. I have tried to use a function which is function onTouched() but I don't know how to make the player switch teams. I should be able to script the kill and the gui part just don't understand the changing teams part.
I thought modified spawnlocations do that but if u really want to get a well functioning one try this script :
local Part = script.Parent Part.Touched:Connect(function(hit) local Player = game.players:FindFirstChild(hit.Parent.Name) if not Player then return end Player.Team = game.Teams.Maroon -- Team instance inside of the Teams service Player.TeamColor = -- The BrickColor of the team like Maroon end)
Try one or the other method Remember to put the script inside of the Part