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

how do I Check what color a block is?

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.

1 comment

0

thank you guys!

4 answers

✓ Accepted answer

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

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

1 comment

0

ok

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

Try this

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

if part then
	print(part.BrickColor)
end

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