In my game, there is a part which represents a seed on top of a part which is meant to look like soil. If a player steps on the soil part, the seed will slowly become transparent. After that, the function is disconnected. This part of the script is successful. However, after that part of the script, I want another part (sprout) to emerge after a player touches the soil again.
This is what I've tried and it's not working:
--When the seed dissolves in the soil after being touched
seed = game.Workspace.Seed
yop = script.Parent.Touched:connect(function(x)
if x.Parent:FindFirstChild("Humanoid")then
yop:disconnect()
for i= 0,1,0.01 do
seed.Transparency = i
wait()
end
end
end)
--a sprout emerges
script.Parent.Touched:connect(function(x)
if x.Parent:FindFirstChild("Humanoid")then
if game.Workspace.Seed.Transparency == 1 then
for m = 1,0,-0.01 do
game.Workspace.Sprout.Transparency = m
end
wait()
end

7 comments
Ooh but when I do elseif, it does not work!
@crystalclay What is the error?
Elseif shows up underlined in red when I type it.
@crystalclay fixed it
This still did not work.
@crystalclay Ok now fixed it, i tested it and it works. But make sure this script is in the part.
Thank you for testing it! However, it is in the part, but it does not work and your script has a few mistakes. I noticed that you forgot to add "Sprout" into the part, and the part itself is supposed to be stepped on, not the seed . I'm sorry if I wasn't too descriptive