CFrame.Angles problem

Hello devforum, so recently I came across a problem. So basically what Im trying to do is to set character’s cframe.angles, but you can’t directly “set” them, because you can only multiply them (*).

My script:

game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.Angles(0, math.rad(25), 0)
  • That will basically multiply my current angle by 25.
    What Im trying to achieve: Get the script to SET them directly and not get them multiplied. Ive tried searching for the solution for a couple of times but that didn’t work out too well. I hope you can help me!
    Thanks in advance.

(This is what my script but randomized version of it looks like in-game)
GIF

1 Like

You need an origin CFrame to set it. However this is a moving player so i am unsure.

I suppose you could use CFrame.LookAt().

Couldn’t you use Model:SetPrimaryPartCFrame? also CFrame.LookAt() Is already incorporared when multiplying the cframe angle if I’m not mistaken.

SetPrimaryPartCFrame is basically the same as setting a part’s CFrame except it’s moving a whole model.

Well his intentions are a little unclear because it shows he’s trying to move the HumanoidRootPart which would generally be done when trying to edit the entire model.

2 Likes

Oh yeah i didn’t realise that, yeah you need to set the primarypartcframe cause it’s the player model.

Im not trying to move my character, im trying to change it’s view angles.

Which will basically make character look at a set direction, that’s what im trying to achieve

I think setting the c0’s for the motor6ds would be for this situation.

local Player = game.Players.LocalPlayer

local Char = player.Character or player.CharacterAdded:Wait()

Char:SetPrimaryPartCFrame(Char.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0))

Yes, you can keep the same CFrame location while editing the angle when using primarypartcframe

Yes, thats the case when multiplying CFrame.Angles, but thats not my problem, the problem is that Im trying to set it to a proper value and not multiply it

Oh okay, nevermind then. (characters)

You can multiply the HumanoidRootPart CFrame with the angle then set the lowertorso to the CFrame?

It would just give you the rotation relative to the humanoidrootpart without changing the humanoidrootpartCFrame.

That does not solve my problem, with the script that I made, it wont change anything other than view angle, it wont change any CFrame properties (besides the view angle obviously) Im trying to achieve a script that will directly set my view angle (cframe.angles) to a proper value, and not multiplying it.

The only reason it isn’t set is because you are iterating it.

you can manually set a CFrame’s Position and Rotation with
image

but I have same question how can you just set it with 3 degrees

I already know that, That’s actually the reason Im looking for a solution!