All I'm attempting to do is to have the color of the brick(part) alternate colors whenever the part is touched. I've already used print statements to see whether or not the function is running, which it is running just fine. The real issue is that the if statements don't run.
The part that I'm working on is currently "really red" by default at the start and it's floating so the function shouldn't be bugging too much from other parts touching it (i.e touching the baseplate).
Not sure why the if statements don't start, any explanations?
local part = script.Parent
local db = true
function change()
if part.BrickColor == "Really red" and db then
db = false
part.BrickColor = BrickColor.new("Lime green")
wait(1)
db = true
end
if part.BrickColor == "Lime green" and db then
db = false
part.BrickColor = BrickColor.new("Really red")
wait(1)
db = true
end
end
part.Touched:Connect(change)

1 comment
it doesn't recognise "Really red" u neew to specify thats its a brickcolor