Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] My sentry turret script isn't working as intended?

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 answer

✓ Accepted answer

nvm lmao I was stupid af

1 comment

0

mood. glad you got it solved.

This discussion is preserved as it was. New answers, comments, and votes are closed.