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

How do I make a Team-Checking and Team-Moving script?

Asked by 9 years ago

I've asked this question multiple times on the forums, and wasn't able to get the correct answer, and so here I am, asking the nice community, if you guys could help me with this; How would a script go, if it's tasked with checking if anyone's in "Neutral" Team, and if that's true, it would create a team and put them into the one that has been created?

2 answers

Log in to vote
2
Answered by 9 years ago

You of course are going to have to make some edits of the script I am about to list below, but I will include steps on what you may have to edit!

Step 1: Create a new script, name it whatever and place it in Workspace Step 2: Throw this code into the script, be sure to read below about the edits you have to do.

The code:

local teams = game:GetService("Teams")
local neutral = teams:FindFirstChild("Neutral")
local redteam = Instance.new("Team", teams)
redteam.Name = "Red Team"
redteam.TeamColor = BrickColor.new("Really red")
local okayvalue = false

if teams and redteam and neutral then
    okayvalue = true
end

game.Players.PlayerAdded:connect(function(player)
    if okayvalue == false then
        repeat
            wait()
        until
            okayvalue == true
        if okayvalue == true then
            print("ready")
            player.TeamColor = BrickColor.new("Really red")
        end
            elseif okayvalue == true then
        player.TeamColor = BrickColor.new("Really red")
    end
end)

Step 3: If you are going to change the team color and team name, then replace everything for team color that says "Really red" with the new color name. If you are going to change the team name, change redteam.Name = "newnamehere"

Step 4: This should work, enjoy your new script c:

0
Works only in studio. Aperturee 22 — 9y
Ad
Log in to vote
-1
Answered by 9 years ago

Works only in studio.

Answer this question