So recently I have tried making doors move diagonally, but cannot find the solution yet. Instead, one part of the door moves upwards and the other moves the right way. There also seems to be a bug with the door (It moves to the right/left, instead of vertically). Any help with this?
Video:
Code:
local TweenService = game:GetService(“TweenService”)
local model = script.Parent
local leftDoor = model.LeftDoor
local rightDoor = model.RightDoor
local prompt = model.Top.Attachment.ProximityPrompt
local tweenInfo = TweenInfo.new(1)
local leftGoalOpen = {}
local leftGoalClose = {}
leftGoalOpen.CFrame = leftDoor.CFrame * CFrame.new(leftDoor.Size.X, 10, 0)
leftGoalClose.CFrame = leftDoor.CFrame
local leftTweenOpen = TweenService:Create(leftDoor, tweenInfo, leftGoalOpen)
local leftTweenClose = TweenService:Create(leftDoor, tweenInfo, leftGoalClose)
local rightGoalOpen = {}
local rightGoalClose = {}
rightGoalOpen.CFrame = rightDoor.CFrame * CFrame.new(rightDoor.Size.Y, 0, 0)
rightGoalClose.CFrame = rightDoor.CFrame
local rightTweenOpen = TweenService:Create(rightDoor, tweenInfo, rightGoalOpen)
local rightTweenClose = TweenService:Create(rightDoor, tweenInfo, rightGoalClose)
prompt.Triggered:Connect(function(player)
prompt.ActionText = “”
leftTweenClose:Play()
rightTweenClose:Play()
prompt.ActionText = " "
wait(2)
leftTweenOpen:Play()
rightTweenOpen:Play()
prompt.ActionText = “”
end)
I have tried looking for this on youtube along the devhub, but have not found something working for me.