So, I've made a turret from Portal and its panels are supposed to retract after 5 seconds but I can't use wait(5) in a loop, any fixes?
Left = game.Workspace.Left
Left1 = game.Workspace.Left1
Left3 = game.Workspace.Left3
Right = game.Workspace.Right
Right1 = game.Workspace.Right1
Right3 = game.Workspace.Right3
poop = script.Parent.no
wait(1)
script.Parent.Touched:Connect(function(lol)
for i = 0, 1, 0.01 do
wait(i/100)
Left.CFrame = Left.CFrame:Lerp(Left1.CFrame, i)
Right.CFrame = Right.CFrame:Lerp(Right1.CFrame, i)
Left.CFrame = CFrame.new(Left.Position, lol.Position)
Right.CFrame = CFrame.new(Right.Position, lol.Position)
end
-- b is supposed to play after i which b is the retracting lerp
for b = 0, 1, 0.01 do
Left.CFrame = Left.CFrame:Lerp(Left3.CFrame, b)
Right.CFrame = Right.CFrame:Lerp(Right3.CFrame, b)
end
end)

1 comment
mood. glad you got it solved.