I have a sliding door and I wanted to find the script to find the current CFrame and move it to the left or right 3 studs.

local TweenService = game:GetService("TweenService")

local leftdoor = script.Parent:WaitForChild("LeftDoor")
local rightdoor = script.Parent:WaitForChild("RightDoor")

local tweeiningInformation = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)

local leftdoorOpen = {CFrame = CFrame.new()}
local rightdoorOpen = {CFrame = CFrame.new()}
local leftdoorClosed = {CFrame = CFrame.new()}
local rightdoorClosed = {CFrame = CFrame.new()}
local tween1Open = TweenService:Create(leftdoor, tweeiningInformation, leftdoorOpen)
local tween1Closed = TweenService:Create(leftdoor, tweeiningInformation, leftdoorClosed)
local tween2Open = TweenService:Create(rightdoor, tweeiningInformation, rightdoorOpen)
local tween2Closed = TweenService:Create(rightdoor, tweeiningInformation, rightdoorClosed)

script.Parent.HitDetector1.Touched:Connect(function()
    tween1Open:Play()
    tween2Open:Play()
    wait(3)
    tween1Closed:Play()
    tween2Closed:Play()
end)

script.Parent.HitDetector2.Touched:Connect(function()
    tween1Open:Play()
    tween2Open:Play()
    wait(3)
    tween1Closed:Play()
    tween2Closed:Play()
end)

I know the script is missing the actual CFrame numbers, I figured id ask this question then complete the script. But I wanted it to find the current CFrame and move it then two the right 3 studs after being touched. Anyone have any ideas?

1 comment

0

You already have the code required?