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

Help How to make it return to its og position?

Asked by 3 years ago

i couldn't do this I tried for 3 hours now how do I make it return to its original position ignore the left door i didn't code it yet

script.Parent.OnTouch.Entrance.Touched:Connect(function(hit)

    if hit.Parent:FindFirstChild("Humanoid") then
    local part = script.Parent.OnTouch.Part
    local part2 = script.Parent.OnTouch.Part2
    local RightDoor = script.Parent.DoorRight
    local LeftDoor = script.Parent.DoorLeft
    local DoorRightPos = script.Parent.DoorRightPos
    local key = 0

    for i = 0,1, .01 do
            RightDoor.CFrame = RightDoor.CFrame:Lerp(part2.CFrame ,i)

            wait(2)


            if key == 1 then
                          break
                    end     
            wait(2)
            key += 1 
            RightDoor.CFrame.Position = DoorRightPos.CFrame.Position








    end
    end
end)

its also not lerping

1 answer

Log in to vote
0
Answered by 3 years ago

Set the value of its position at the beginning so you have its original position. Original Post = part.position. yeah?

0
thx a lot ghgg471 8 — 3y
Ad

Answer this question