So I'm making a blooming garden, which the person themselves grows just by stepping on it.
If they step on the soil, the seed will become transparent, and a sprout will bloom in place. If a person steps on the soil again, a flower will bloom in place.
This is my script so far:
debounce = false
script.Parent.Soil.Touched:connect(function()
if not debounce then
debounce = true
for i = 0, 1, 0.1 do
script.Parent.Seed.Transparency = i
wait (0.1)
end
wait(10)
debounce = false
end
debounce = true
if debounce then
for i = 1, 0, -0.1 do
script.Parent.Sprout.Transparency = i
wait (0.1)
end
wait(5)
end
end)
The problem, the seed "dissolves" once. But the sprout, keeps appearing to flash as a result of it being touched too many times. Hence, I thought a debounce would be a good idea to fix this.
In other words, the debounce worked for the seed but not for the sprout.

1 comment
Thank you so much! My first scripting project is going well! Note to others who have the same problem as me- What I did, was make the second debounce variable and named it "rebounce" or something else.