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

Color Changing Help?

Ok I made a brick color changer for when a part touch it , it changes the part color but instead of changing the parts colors its changing the color of the brick color changer itself and leaving the parts with no color change

function onTouched(part)
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Bright blue")
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Bright violet")
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Bright orange")
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Pastel blue-green")
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Sand blue")
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Br. yellowish orange")
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Grime")
wait(0.2)
script.Parent.BrickColor = BrickColor.new("Pastel blue")
wait(0.2)
end
script.Parent.Touched:connect(onTouched)

2 comments

0

Add a Debounce so that your code doesn't fire multiples on execution.

0

where do i add the debounce?

1 answer

✓ Accepted answer

From what is looks like, you should make it

part.BrickColor = BrickColor.new("Pastel blue")

Instead of

script.Parent.BrickColor = BrickColor.new("Pastel blue")

The reason being that script.Parent is most likely the color changer, and part is the part you want to color.

5 comments

0

I'll Try Right now

0

the parts start randomly flashing

1

The wait you used may be too short. Another thing to consider s adding debounce.

0

how to add a debounce?

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