Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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:

1 comment

0

Works only in studio.

This discussion is preserved as it was. New answers, comments, and votes are closed.