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

Elevator door not sliding the way I want it to?

Asked by 3 years ago

I tried to make elevator doors except for some reason, one of the elevator doors wouldn't go left and instead went towards me a little and the other elevator doors went the other way which was going away from me. I can't figure out on how I can fix this.

local TweenService = game:GetService("TweenService")

local model = script.Parent
local leftDoor = model.Left
local rightDoor = model.Right
local prompt = model.parent.Call.call.ProximityPrompt

local tweenInfo = TweenInfo.new(1)


local rightOpen = {}
local rightClose = {}
rightOpen.CFrame = rightDoor.CFrame * CFrame.new(-rightDoor.Size.X, 0, 0)
rightClose.CFrame = rightDoor.CFrame
local rightTweenOpen = TweenService:Create(rightDoor, tweenInfo, rightOpen)
local rightTweenClose = TweenService:Create(rightDoor, tweenInfo, rightClose)

local leftOpen= {}
local leftClose = {}
leftOpen.CFrame = leftDoor.CFrame * CFrame.new(leftDoor.Size.X, 0, 0)
leftClose.CFrame = leftDoor.CFrame
local leftTweenOpen = TweenService:Create(leftDoor, tweenInfo, leftOpen)
local leftTweenClose = TweenService:Create(leftDoor, tweenInfo, leftClose)

prompt.Triggered:Connect(function(player)
    if prompt.ActionText == "Close" then
        leftTweenClose:Play()
        rightTweenClose:Play()
        prompt.ActionText = "Open"
    else
        leftTweenOpen:Play()
        rightTweenOpen:Play()
        prompt.ActionText = "Close"
    end
end)

1 answer

Log in to vote
0
Answered by 3 years ago

Never mind, figured it out. Used the 3rd value for CFrame instead which was Z.

Ad

Answer this question