I am creating a gate that should tween down and upon command. It does but it rotates weird and then does not go where I want it to. After it is open whenever it goes up it should be at the same 90° angle - somewhat a 90° angle.- and it should go back to position but it fails to do so.
Rotation Of Gate: -24.09, 0, 0
Script:
local Gate = workspace:WaitForChild("Gate")
local TweenService = game:GetService("TweenService")
local Activated = false
local Tween1Information = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut
)
local Tween2Information = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut
)
local Tween1 = {
CFrame = CFrame.new(31.749, -26.276, 16.473),
}
local Tween2 = {
CFrame = CFrame.new(31.749, 25.761, -6.788),
}
local Open = TweenService:Create(Gate,Tween1Information,Tween1)
local Close = TweenService:Create(Gate,Tween1Information,Tween2)
script.Parent.MouseClick:Connect(function()
if Activated == false then
Activated = true
Open:Play()
elseif Activated == true then
Activated = false
Close:Play()
end
end)

2 comments
CFrame includes both position and rotation, when you don't include rotation values it sets it to 0
How would I include rotation values?