How would I go about making parts face outward from the player?


I want to know how I can get the parts to face outward from where the player is facing.

First, get each part’s position relative to the player, then you can use CFrame.lookAt() with the relative position you calculated earlier to make them face away from the player.


tried this and it went well but I gotta tweak a few stuff :smile:

Can you send the code you used? or are the parts supposed to be positioned like that?

The easy way is to use CFrame.new(myPos, LookatPos) or Cframe.lookAt(myPos, LookatPos).

A more mathematical way would be to do some Vector math. Solve for a vector projection of lookAt onto myPos.

Or you can solve for the dot product.

I used math pi [for i = 1, math.pi*2, 1.5 do]

local x = math.cos(i) * Radius -- 5
				local z = math.sin(i) * Radius
				local position = (HumanoidRootPart.CFrame * CFrame.new(x, 0, z)).Position
				local lookAt = HumanoidRootPart.Position

				VFX.CFrame = CFrame.new(position, lookAt)
				hitbox.CFrame =VFX.CFrame

You should make i in the range of 0 - 3 and replace i in the math.cos and math.sin with i * math.pi/2.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.