local y = script.Parent.CFrame.Y
local part = script.Parent
local button = workspace.Button2.button2.scriptpart2
local e = 4
button.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then
		repeat wait() until button.Touched 
			while true do
			repeat wait() until e < 1
				part.CFrame	= CFrame.new(36, y + 0.05, -36)
			e = e - 1
			print(e)
			wait(0.05)
			repeat wait() until e > 9
			    part.CFrame	= CFrame.new(36, y - 0.05, -36)
			e = e + 1
			print(e)
			  	end
			   
			end
		end
)

1 comment

0

repeat wait() until e < 1 does not pass. e is 4 and 4 is not smaller than 1. e’s value only change after the loop.