For example, I have a brick that when you click it once, the color is red, you click it a second time and it's yellow, a third time it's blue and the fourth time it goes back to red and the cycle repeats. How can I archieve this?
As Ponytails2017 said, this is not a request site. As you did make an effort to post your attempts, I am happy to help. Just remember in the future to follow the guildelines.
local clickDetector = script.Parent -- instance of ClickDetector local uses = 0 clickDetector.MouseClick:Connect(function(player) uses = uses + 1 if uses == 1 then clickDetector.Parent.BrickColor = BrickColor.new("Bright red") elseif uses == 2 then clickDetector.Parent.BrickColor = BrickColor.new("Baby blue") uses = 0 -- reset the count after the 2 clicks to continue checking end end)
You should check this out for more information: ClickDetector API
EDIT
I noticed I forgot to change 'script.Parent.BrickColor' to 'clickDetector.Parent.BrickColor'. It has been fixed.
write a variable called uses or something
local uses = 0 if uses == 1 then uses += 1 (change color here) elseif uses == 2 then uses += 1 (change color here) elseif uses == 3 then uses += 1 (change color here) end -- and repeat, inset this inside of the click detector function
This is not a request site dude, try it first then if it doesn't work we can help you. https://scriptinghelpers.org/help/community-guidelines
Tried to make it myself, but this doesn't work still.
while wait(1) do local value = 0 if value == 0 then script.Parent.BrickColor = BrickColor.new("Bright red") value = value + 1 end if value == 1 then script.Parent.BrickColor = BrickColor.new("Bright yellow") value = value + 1 end if value == 2 then script.Parent.BrickColor = BrickColor.new("Baby blue") value = value - 1 end end