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

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

Asked by 6 years ago

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

0
please put your code in a code block. I cant see anything TheLionLiar 39 — 6y

1 answer

Log in to vote
0
Answered by
xPolarium 1388 Moderation Voter
6 years ago
Edited 6 years ago

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

edit: readability

Ad

Answer this question