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
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.
01 | --Assuming you have a team in Teams with the proper BrickColor set on it: |
02 |
03 | local part = workspace:WaitForChild( "NYGNO" ) |
04 | --Waiting for your part to load in |
05 |
06 | local brickColor = BrickColor.new( "Really black" ) |
07 | --This is up here that way you can change it later |
08 |
09 | game.Players.PlayerAdded:Connect( function (player) |
10 | if part.BrickColor = = brickColor then |
11 | player.TeamColor = brickColor |
12 | end |
13 | end ) |
edit: readability