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

Help me please! How to do? (TeamColor) I don`t know.iiiiiiiiiiiiiii

I want to make all players throw up for one command if the object is the right color. I do not know how to write a change to TeamColor.

The script itself

local player = game.Players.LocalPlayer

if game.Workspace.NYGNO.BrickColor == BrickColor.new("Really black") then player.TeamColor = end

1 comment

0

please put your code in a code block. I cant see anything

1 answer

You cannot use LocalPlayer in a server-side Script. Use PlayerAdded event that is accessible by scripts.

TeamColor property needs a BrickColor value so you can use the Part's BrickColor you're using.

--Assuming you have a team in Teams with the proper BrickColor set on it:

local part = workspace:WaitForChild("NYGNO")
 --Waiting for your part to load in

local brickColor = BrickColor.new("Really black")
 --This is up here that way you can change it later

game.Players.PlayerAdded:Connect(function(player)
	if part.BrickColor == brickColor then
		player.TeamColor = brickColor
	end
end)

edit: readability

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