Hello, I am having trouble making loops. Mainly because I do not fully understand them, and how they work. Help me, please.
This is how I want the loop to be but just as a onTouched, instead of a click.
script.Parent.ClickDetector.MouseClick:Connect(function()
for i = 0, 1, .1 do
game.Workspace.WoodlogWB.WoodP.Transparency = 1 - i
wait(0.1)
end
game.Workspace.WoodlogWB.WoodP.CanCollide = true
end)
This is the script I want to become a loop, not infinite loop, just a loop for 10 times going down.
function onTouched()
game.Workspace.StepBlock.White2.Transparency = 0.9
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.8
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.7
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.6
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.5
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.4
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.3
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.2
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0.1
wait(0.1)
game.Workspace.StepBlock.White2.Transparency = 0
wait(0.1)
game.Workspace.StepBlock.White2.CanCollide = true
end
script.Parent.Touched:Connect(onTouched)

6 comments
Don't post about how stupid I am, just help me.
I will which script do you want looped top or bottom or both??
Bottom, top is already looped.
put the loop in the function smh...
Oh ok
you can use tweenservice for a smoother transition