Model Orientation Problems!

I’m having a little bit of struggles with scripting and a model orientation. I’m new to scripting and don’t know what am doing wrong. I’ve been working on this for about an hour now and now I give up. It might be very simple to fix but again I’m new and don’t know much about scripting. Hopefully I don’t make this too complicated by basically…

I have a local script in StarterPlayerScripts.

Screenshot (528)

And in that script is a few lines of code:

local Part = game.Workspace.Camera:WaitForChild("Ladder")
local Part2 = game.Workspace.Ladder2
local Open = game.Workspace.Button
local Sound = game.ReplicatedStorage.Music
local Destination = CFrame.new(-164.062, 16.655, -133.394)
local Destination2 = CFrame.new(-121.401, -2.24, -37.726)

function onClicked()
	Sound:Play()
	Part2:SetPrimaryPartCFrame(Destination2)
	Part:SetPrimaryPartCFrame(Destination)
	Part.CFrame = Destination * CFrame.fromEulerAnglesXYZ(0,123,120)
	Open.CFrame = CFrame.new(-164.478, -13.578, -40.731)
end 
workspace.Button.ClickDetector.MouseClick:connect(onClicked)

I also have a ladder model in Lighting. I want the Orientation of the ladder to look something like this:

But for some reason whenever I join and set everything up the ladder Orientation looks like this which is what I dont want:

So basically the ladder position is perfect but the orientation is way off and I don’t know how to fix this. Thanks and sorry if I made it a little complicated.

1 Like

Try to use Part:SetPrimaryPartCFrame(CFrame.new(Destination * CFrame.fromEulerAnglesXYZ(0,123,0)))

1 Like

Still stuck in same position.

Im using a local script because the ladder is supposed to be a local part.

Is the ladder supposed to be like this when you press the button or all the time? if so then what are the original orientation of the model?

Yes I want the ladder to only show when I click the button. And right now the origin of the ladder is (85, -175, 180).

try this one:

local part = script.Parent

part:PivotTo(part.PrimaryPart:GetPivot() * CFrame.Angles(0,0,math.rad(90)))

Make sure that the Orientation is set to 0,0,0 for it to work

1 Like

Ok well good news its something new happened, it kinda changed rotation but I want it upright.

Maybe this one?

CFrame.Angles(0,math.rad(90),0)
3 Likes

Ok it works alright now, its facing upright. Thanks a lot and sorry for the struggles.

1 Like

Oh well, now there are problems. Ok im really sorry but this is the line I put down:

	Part:PivotTo(Part.PrimaryPart:GetPivot() * CFrame.Angles(math.rad(75),math.rad(0),math.rad(0)))

And it makes the ladder like this:

I want it rotated 180 degrees to the right so it looks like its connecting to the house.

I mean that’s what I did and it doesn’t work. Oh well, I’ll see what I can do thanks.