this is the script i have, at the moment it only works on the Z Axis
Model = script.Parent
local TweenService = game:GetService("TweenService")
Open = false
CurOpening = false
Door1NP = Model.Door1.Position
Door2NP = Model.Door2.Position
Door1NS = Model.Door1.Size
Door2NS = Model.Door2.Size
Door1LV = Model.Door1.CFrame.LookVector
Door2LV = Model.Door2.CFrame.LookVector
local tweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
Model.Button.ClickDetector.MouseClick:Connect(function(player)
if CurOpening == true then return end
if Open == false then
CurOpening = true
print(Door1LV)
print(Door1NS)
print(Door1LV*Door1NS)
local tween1 = TweenService:Create(Model.Door1, tweenInfo, {Position = Door1NP+(Door1LV*Door1NS)})
local tween2 = TweenService:Create(Model.Door2, tweenInfo, {Position = Door2NP-(Door1LV*Door1NS)})
tween1:Play()
tween2:Play()
wait(tweenInfo.Time)
CurOpening = false
Open = true
else
CurOpening = true
local tween1 = TweenService:Create(Model.Door1, tweenInfo, {Position = Door1NP})
local tween2 = TweenService:Create(Model.Door2, tweenInfo, {Position = Door2NP})
tween1:Play()
tween2:Play()
wait(tweenInfo.Time)
CurOpening = false
Open = false
end
end)
to make it work on the X axis i replace the begining with this
Model = script.Parent
local TweenService = game:GetService("TweenService")
Open = false
CurOpening = false
Door1NP = Model.Door1.Position
Door2NP = Model.Door2.Position
Door1NS = Model.Door1.Size
Door2NS = Model.Door2.Size
Door1NS = Vector3.new(Door1NS.Z,Door1NS.Y,Door1NS.X)
Door2NS = Vector3.new(Door2NS.Z,Door2NS.Y,Door2NS.X)
Door1LV = Model.Door1.CFrame.LookVector
Door2LV = Model.Door2.CFrame.LookVector
but i need to make it so it works any direction which i am confused about how to do, i will be thankful for any help.
