So I am creating a script for an interactive garden. If the player steps on the soil which contains a seed on top, the seed dissolves. When a player walks on it once again, a sprout slowly appears. I did that part successfully using two debounce variables.
But I want to continue the script. If the player walks across the soil which now contains the sprout, the sprout will dissolve and a flower will bloom in place.
This is the script so far:
debounce = false
rebounce = false
mbounce = 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(20)
debounce = false
end
if not rebounce then
rebounce = true
for i = 1, 0, -0.1 do
script.Parent.Sprout.Transparency = i
wait (0.1)
end
wait(20)
rebounce = false
if not mbounce then
mbounce = true
for i = 0, 1, 0.1 do
script.Parent.Sprout.Transparency = i
wait (0.1)
end
wait(20)
mbounce = false
end
end
end)
wait(5)
script.Parent.Sprout:Destroy()
How come when I use the "Destroy" Instance, it doesn't work at all?
Also, I want to do the for loop to get rid of the sprout, so it can appear to dissolve. But, when I did the for loop with a separate debounce variable, it did not work at all.
