So I'm making these doors, and when you press a button with a ClickDetector in it, it will lerp the door to a duplicate door inside the wall. Anyways, my code works fine, but when it moves, it goes instantly. The tutorial I watched said to add a for loop, so I did that, but it doesn't seem to help?
My code inside the button:
local ClickDetector = script.Parent.ClickDetector
local Button = script.Parent
local Door1 = workspace.Union1
local Door2 = workspace.Union2
local DoorGoingTo1 = workspace.UnionGoTo1
local DoorGoingTo2 = workspace.UnionGoTo2
function MouseClick()
Button.Color = Color3.fromRGB(255, 0, 0)
for i = 0, 1, .01 do
Door1.CFrame = Door1.CFrame:Lerp(DoorGoingTo1.CFrame, 1)
Door2.CFrame = Door2.CFrame:Lerp(DoorGoingTo2.CFrame, 1)
end
end
ClickDetector.MouseClick:Connect(MouseClick)

1 comment
How silly of me, I just noticed. Thank you.