Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What I have wrong in CFrame lerping?

Asked by
zeptak 4
5 years ago

I've done a script what is working but when I want to close the doors it will start bug. Its opening and closing both and I dont know how to handle with that. :/

if d == false then
        d=true
        for i = 0,1,.00001 do
            local cfm = workspace.SurfaceBlastDoor.PrimaryPart.CFrame:Lerp(finish,i)
            workspace.SurfaceBlastDoor:SetPrimaryPartCFrame(cfm)
            wait()
        end
    else
        d=false
        for i = 0,1,.00001 do
            local cfm = workspace.SurfaceBlastDoor.PrimaryPart.CFrame:Lerp(starpos,i)
            workspace.SurfaceBlastDoor:SetPrimaryPartCFrame(cfm)
            wait()
        end
end
0
Please explain a bit more. do you mean it opens and closes the door at the same time? User#5423 17 — 5y

Answer this question