Rotating a CFrame and Aiming it at the same time

Im making a combat game and a projectile Im making needs to be able to Aim at a part/player which is simple with “CFrame.new(Subject, Look)”.

However I have no idea how to add another CFrame onto it so that way it rotates while aiming. I’ve gone through many sources and havent found anything similar to what Im looking for.

This is most likely a simple solution I just can’t find it anywhere.

You can simply multiply another CFrame to the product from CFrame.new(origin, lookAt):

local rot = CFrame.new(projectile_Pos, HRP_Pos) * CFrame.new(0, 1, 0) * CFrame.Angles(0, math.pi, 0) -- an example

It just causes it to circle around the Object its looking at. It moves in the direction of the Orientation.

I didn’t realize you just wanted to rotate it only, you can try this:

local ang = 0 -- current angle
local rotspeed = 5 -- degrees per second

game:GetService("RunService").RenderStepped:Connect(function(dt)
   local cf = CFrame.new(projectile_Pos, HRP_Pos) * CFrame.Angles(0, 0, ang)
   ang = ang + (dt * 5) -- dt stands for deltatime: the time since the last frame
end)

Tested, and it works fine

Its server-side, renderstepped won’t work for what Im doing.

You can use Stepped, Heartbeat, or while loop with wait instead

Now it just dosent move. No error though.
I changed the script to this;

local ang = 0 -- current angle
local rotspeed = 5 -- degrees per second

while wait() do
local cf = CFrame.new(script.Parent.Position, workspace.Part.Position) * 
CFrame.Angles(0, 0, ang)
ang = ang + (.01 * 5) -- dt stands for deltatime: the time since the last frame
end

Worked fine for me. Are you actually applying the cframe to the part?

Had to switch some things around and apply the cframe again, all working now. Thanks for the help! Usually you don’t get responses this fast so I turned out quite lucky this time.