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

how do I Check what color a block is?

Asked by 2 years ago

basically im making a red light green light type game and I want the part to kill you when it is red but I dont know how to check the parts brick color, I want it to be like if part is this color then but I dont know how to check if it is that color.

0
thank you guys! therealjimmybob 22 — 2y

4 answers

Log in to vote
0
Answered by 2 years ago

Try to use a local variable like this

local part = script.parent.brickcolor

print(Part)

if part.brickcolor = "Green" then:connect(function()

idk if the function bit works but the rest does

Ad
Log in to vote
1
Answered by 2 years ago

Try checking the brick color as in your setting a brick color in code

if part.BrickColor == BrickColor.new('Black') then
    print('its black!')
end
0
ok therealjimmybob 22 — 2y
Log in to vote
0
Answered by 2 years ago

I think you should use this simple method to know if it is red or green.

 if part.BrickColor == BrickColor.new('Lime green') then
    print('Its green!')
end
Log in to vote
0
Answered by
MattVSNNL 620 Moderation Voter
2 years ago

Try this

local part = game.Workspace:FindFirstChild("Part")

if part then
    print(part.BrickColor)
end

Answer this question