CFrame.Angles() not working

Making a door that opens using TweenService, I also have a rotating part called lock (it’s a vault door).

The door opens as expected but the lock part doesn’t move at all.

Script:

local TweenService = game:GetService("TweenService")
local DoorInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local LockInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 3)

local VaultDoorModel = script.Parent
local Lock = VaultDoorModel.Lock
local ClickDetector = Lock.ClickDetector
local Door = VaultDoorModel.Door
local Hinge = VaultDoorModel.Hinge

local TweenDoor = TweenService:Create(Hinge, DoorInfo, {CFrame = Hinge.CFrame * CFrame.Angles(0, -math.rad(90), 0)})
local TweenLock = TweenService:Create(Lock, LockInfo, {CFrame = Lock.CFrame * CFrame.Angles(0, 0, math.rad(360))})

ClickDetector.MouseClick:Connect(function()
	TweenLock:Play()
	wait(2.5)
	TweenDoor:Play()
end)
1 Like

I’m pretty sure that’s because if you go 360° around a circle you’ll be in the same place you started.

1 Like

Wouldn’t it actually move around though?

Edit: Changed it to 180, still doesn’t move.

No. When tweening a cframe it is altering it to be at that position and orientation. However, if you are going all the way around back to your starting point you are already at that position and orientation, so there’s no need to move any.

So I changed it to 180 and it still didn’t move- Is it the same issue or something else?

IDK. Let me test the code and I’ll get back to you. In the meantime one improvement I can recommend is too replace

With

TweenLock.Completed:Wait()
1 Like

Why don’t you just position and orient Lock and Door parts correctly ? If you do that you don’t have to use CFrame.Angles() because CFrame has orientation built-in

If not please could you show me a picture of what happens and what you would like the door to do?

Try doing 359 and not 360:

local TweenLock = TweenService:Create(Lock, LockInfo, {CFrame = Lock.CFrame * CFrame.Angles(0, 0, math.rad(359))})

I was able to get mine to work using a union by doing

local TweenLock = TweenService:Create(Lock, LockInfo, {CFrame = Lock.CFrame * CFrame.Angles(math.rad(180), 0, 0)})

print("Activate")
TweenLock:Play()

so it’s probably something else. Do you see any warning’s or errors in the output?

No errors. charlimitaaaaaaaaaaaaa

Just asking, were you ever able to fix this?

1 Like