Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a script that changes teams?

Asked by 10 years ago

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".

0
Why would you need a ClickDetector? Is it automatic or is it manual? OniiCh_n 410 — 10y
0
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. Tallestmidget7 95 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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!

Ad

Answer this question