So I have a gate script which works all good, but for some reason, When I click the gate, it moves up, but turns it into the orientation of 0, we need the orientation to 0,90,0. So we did that after each tween played. But still when we click it, it turns it back to 0 orientation. Here is the server script:
local TweenService = game:GetService("TweenService")
local door1 = script.Parent.Parent.Part1
local tweeningInformation = TweenInfo.new(
2,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local door1Open = {CFrame = CFrame.new(-161.498, 15.143, -125.72)}
local door1Close = {CFrame = CFrame.new(-161.498, 5.666, -125.72)}
local tween1open = TweenService:Create(door1,tweeningInformation,door1Open)
local tween1close = TweenService:Create(door1,tweeningInformation,door1Close)
local open = false
script.Parent.ClickDetector.MouseClick:Connect(function()
if not open then
open = true
tween1open:Play()
door1.Orientation = Vector3.new(0,90,0)
else
tween1close:Play()
door1.Orientation = Vector3.new(0,90,0)
open = false
end
end)

3 comments
CFrame.new(pos) creates a cframe with a position matrix of
posand a default rotation matrixif you want to keep the rotation matrix, you can get it by doing thing.Cframe - Thing.CFrame.Position, then add that to the new cframe created from the position
Uh can you give an example in a script? Kinda hard to understand.