Orientation problems again

Iven spent so much time on this issue that I don’t know what to do anymore. I already made a most about Orientation problems but now I’m having more problems with it. I didn’t think this would take long too fix but it ended up taking longer than expected and now I need help. Right now I have a model which in this case is a ladder. I want the ladder to be pivoted in a certain position

Here I have a local script inside of StarterPlayerScripts. I also have a part named Ladder which is in Lighting at the moment.

local Part = game.Workspace.Camera:WaitForChild("Ladder")
local Destination = CFrame.new(-164.325, 16.513, -133.499)

function onClicked()
	Part:SetPrimaryPartCFrame(Destination)
	Part:PivotTo(Part.PrimaryPart:GetPivot() * CFrame.Angles(math.rad(75),0,0))
end 
workspace.Button.ClickDetector.MouseClick:connect(onClicked)

Now I would like the ladder to look something like this so its leaning beside the roof of the cabin:

But whenever I join the ladder is orientated like and is a little off:

I’m very new to scripting and appreciate the help I can get, also I did change the numbers of the Z X and Y axis in the script but it still did not work. I’m at the point where I think the code might be incorrect but I’m not too sure. Thanks again.

Unless there’s some specific reasoning for you needing to manually set the position via a script, I think it would be easier to just position your ladder in studio, move it to someplace like ReplicatedStorage, and just clone it upon pressing the button.

1 Like

Sorry, I forgot to mention its in Lighting because I wanted to make it a local part.

It will still be a local part even if you store it in ReplicatedStorage. Lighting isn’t meant to store stuff anyhow, and should only include things for post-processing and, well, lighting (duh).

1 Like

Alright thanks, I moved it to Replicated Storage but the orientation is still not working as how I want it too.

Yeah, like I said, I would recommend you position the ladder using studio tools and then just clone it during runtime. It’ll clone in the same exact state as how you pre-positioned it, eliminating the need to manually position the ladder.

2 Likes

Just as @luvebrainz said, you should make the part already have a position (Even if in replicated storage).
But! I think I know what caused the problem here. It’s all about this part of your script:

CFrame.Angles(math.rad(75),0,0))

Because, well… to make it face upwards i believe its needed to set the it to 90 degrees, not 75.
After all a 75 Angle is not a right angle, but 90 is.

Unless your lader’s orientation is somehow baked (which is not possible unless you use an external software like blender). I dont think someone could make such a mistake tho, so try changing the 75 for 90.

1 Like

Oh well, I fixed it. Took longer then it should off, but thanks for telling me that I could put it in Replicated Storage. I knew that was a better location for it but didn’t know if it would work.

1 Like

Yea, I figured that out just now. I don’t know why it took me this long to figure out that all I needed to do was set it to 90 degrees. For some reason I tried to rotate it on the Z axis.

1 Like

I sometimes do it manually because of event-interactive parts. (like if you’ve finished a quest)
If you have to do it that way, try just coping the CFrame of the part or primaryPart where you want it to be. You can make a serverscript under the part and do print(script.Parent.CFrame). Then setting the part to that CFrame by copy-paste ing it or even using a cframeValue.

Just in some special cases. Anyhow, good luck/

2 Likes

Thanks for that, appreciate it.

1 Like