I want to make a script (Not a gui) That will change everyones team. I have no idea how to do this. I know I would put this: -Part -ClickDetector -Script But then the script is where I hit trouble. I really, really need help with this. It's one of the last few scripts I need to finish my game. If you can at the very least push me in the right direction, that'd be great. If it makes any difference to anyone, the teams colors are: "Really red" "Bright yellow" "Bright blue".
COMMUNITY QUESTION
How do I make a script that changes teams?
1 answer
Make sure to put the script in the part, not in the click detector. This script here should work.
Team = "Really Red" --Put the team everybody goes to here
Click = script.Parent.ClickDetector
function onClick()
for i, v in pairs(game.Players:GetChildren()) do --oh how I love v in pairs
v.TeamColor = BrickColor.new(Team)
end
end
Click.MouseClick:connect(onClick)
Fairly simple to be honest. Good luck on your game!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Why would you need a ClickDetector? Is it automatic or is it manual?
Because in the game that I'm making, the player needs to click a brick for the round to end. When the round ends, everyones team changes.