Problem with angles

Hey, I’m having a problem with my script, and I cant find the solution. What I’m trying to acheive is rotating the player’s Character relatively to other part. Let me show some pictures of what I want do:
Instead of the Character be like this:


I want it to be like this:

I tried using raycasting but it didnt worked and always made the Character face the same place the Part is facing.

local CheckRay = Ray.new(HumanoidRootPart.Position,HumanoidRootPart.CFrame.LookVector * 1) 
local CheckPart, position, surface = workspace:FindPartOnRay(CheckRay,Character)

Character:SetPrimaryPartCFrame(CFrame.new(PrimaryPart.Position, surface))

Any help is welcome!

You tried changing this line:

Character:SetPrimaryPartCFrame(CFrame.new(PrimaryPart.Position, surface))

To this:

Character:SetPrimaryPartCFrame(CFrame.new(PrimaryPart.Position, position))

?

1 Like

No, I will try it.

(30 Characters lol)

It kinda worked, but not in the way that I wanted too:

I can’t see what is wrong, the script I gave you is simply rotating the PrimaryPart.Position to the position the charater is facing

The Character is rotated in the X axis and I dont want to it rotate in the X axis.

(The character is on air because I anchored the humanoid root part.)

I will rewrote the script on the mobile, say if u get any error:

Character:SetPrimaryPartCFrame(CFrame.new(PrimaryPart.Position, Vector3.new(PrimaryPart.Position.X,position.Y,position.Z)))

Edit: Repaired the script

My bad I meant the Y axis.

Character:SetPrimaryPartCFrame(CFrame.new(PrimaryPart.Position, Vector3.new(position.X,PrimaryPart.Position.Y,position.Z)))

Thanks alot too! (Gave you the solution.)