I want to know how you would change the color of a block. Lets say i touched a block once and the color is green but i want it to stay green and then when i touch it again with the keycard it turns red so far I can only get it to change one color.....
door = script.Parent
open = false
script.Parent.Touched:Connect(function(part)
local keycard = part:FindFirstChild("keycard")
if keycard ~= nil and keycard.value == true and then
open = true
if open ~= true then
script.Parent.color.brickcolor = BrickColor.new("Really Red")
else
script.Parent.color.brickcolor = BrickColor.new("Bright Green")
end
end)

4 comments
.touched is deprecated use .Touched also :connect is deprecated use :Connect also for check use if keycard then also use local keycard = part.Parent:FindFirstChild("keycard") not local keycard = part:findfirstchild("keycard") also use script.Parent.color.BrickColor = BrickColor.new("Color"), if keycard is in backpack you need to get player, after check keycard in backpack/character
I edited it
what is line 6?
anyways i messed up line 6 earlier so now I know it works thanks for the help!