I am trying to make a drawer that tweens back and forth, and I have the following problem:
- The first drawer tweens how it should, although the second one tweens not in the right direction
local TweenService = game:GetService("TweenService")
local Drawer = script.Parent.Parent.Drawer
local Opened = false
local Value = 2.35
local OpenedCFrame = Drawer.CFrame * CFrame.new(Drawer.CFrame.LookVector * Value)
local ClosedCFrame = Drawer.CFrame
script.Parent.ProximityPrompt.Triggered:Connect(function()
if not Opened then
Opened = not Opened
local Tween = TweenService:Create(
Drawer,
TweenInfo.new(
0.5,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.Out
),
{
CFrame = OpenedCFrame
}
)
Tween:Play()
else
Opened = not Opened
local Tween = TweenService:Create(
Drawer,
TweenInfo.new(
0.5,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.Out
),
{
CFrame = ClosedCFrame
}
)
Tween:Play()
end
end)
How do I fix this?