CFrame Not working proprely!

I believe now the problem is the axis at which it’s rotating.

script.Parent.Parent.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent.Parent.Parent:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(45), 0))

try this line ^

1 Like

I already have it in my code. Still this mess.

1 Like

Try to change math.rad(45) to a different axis.

1 Like

Tried with it being 90 degrees:

1 Like

Can you send me the line of the code that is rotating the door?

1 Like

script.Parent.Parent.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent.Parent.Parent:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(90), 0))

1 Like

This is might be because CFrame.Angles need’s a radian value for it’s parameters.
Also SetPrimaryPartCFrame and GetPrimaryPartCFrame might be deprecated soon.

And in CFrame.Angles(-47.5, 3.975, 128.25) your trying to move the door, not rotate it again.

local Button = script.Parent
local ClickDetector = Button.ClickDetector

local TextLabel = script.Parent.Parent.Parent.Screen.CodeScreen.SurfaceGui.TextLabel

ClickDetector.MouseClick:Connect(function()
	if TextLabel.Text == "696969" then
		TextLabel.Text = "Access Granted! Opening Door..."
		wait(2.9)
	    script.Parent.Parent.Parent.Parent:PivotTo(CFrame.new(-47.5, 3.975, 128.25) * CFrame.Angles(0, 0, math.pi / 4))
	end
end)
2 Likes

Less mess than before: RobloxScreenShot20210720_000111337

1 Like

Maybe change the rotation on the y axis instead.
script.Parent.Parent.Parent.Parent:PivotTo(CFrame.new(-47.5, 3.975, 128.25) * CFrame.Angles(0, math.pi / 4, 0))

2 Likes

Upgraded the mess:

1 Like

Why not try CFrame.Angles(0, math.rad(60), 0) or CFrame.Angles(0, math.rad(120), 0)

1 Like

120:

60:

EDIT: It’s getting late. I’m going to sleep.

EDIT: Nevermind.

1 Like

Alright try CFrame.Angles(0, math.rad(60), 90) or CFrame.Angles(0, math.rad(120), math.rad90) or
CFrame.Angles(math.rad 90, math.rad(60), 0) or CFrame.Angles(math?rad 90, math.rad(120), 0)

You could just copy the CFrame by printing it

1 Like

The CFrame.Angles(0, math.rad(120), math.rad90) barely made it:

Same for the 90, 120 thing:

2 Likes

Does this work?

local Button = script.Parent
local ClickDetector = Button.ClickDetector

local model = script.Parent.Parent.Parent.Parent
local TextLabel = script.Parent.Parent.Parent.Screen.CodeScreen.SurfaceGui.TextLabel

local HINGE_OFFSET = CFrame.new(3, 0, 0)

ClickDetector.MouseClick:Connect(function()
	if TextLabel.Text == "696969" then
		TextLabel.Text = "Access Granted! Opening Door..."
		wait(2.9)
		model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * HINGE_OFFSET * CFrame.Angles(0, math.rad(45), 0) * HINGE_OFFSET:inverse())
	end
end)

SO CLOSEEEEEEEEEEE:

Hey uh… I’m going to sleep. You can still reply to me. But I won’t answer. Thanks!

1 Like

Then it’s only the axis that was wrong!

try
model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * HINGE_OFFSET * CFrame.Angles( math.rad(45), 0, 0) * HINGE_OFFSET:inverse())

or
model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * HINGE_OFFSET * CFrame.Angles(0, 0, math.rad(45)) * HINGE_OFFSET:inverse())

1 Like

Hey. Sorry for the late response. But I said i’m going to sleep. Here are the results:

First Method:

Second Method:

local HINGE_OFFSET = CFrame.new(-3, 0, 0)

model:SetPrimaryPartCFrame(
   model:GetPrimaryPartCFrame() * HINGE_OFFSET * CFrame.Angles(0, 0, math.rad(45)) * HINGE_OFFSET:inverse()
)
2 Likes