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 5 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 — 5y

1 answer

Log in to vote
0
Answered by
xPolarium 1388 Moderation Voter
5 years ago
Edited 5 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.

--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

Ad

Answer this question