Trouble trying to make a model face a part

Here is my current code

fp1:SetPrimaryPartCFrame(CFrame.lookAt(fp1.PrimaryPart.Position,victim.HumanoidRootPart.Position))

It literally does nothing without any errors.
How can I make it so the model faces victim.HumanoidRootPart?
All help is greatly appreciated! Thanks! :slightly_smiling_face:

2 Likes

What is the problem with what you have right now?
Do you have this code in a Runservice.Heartbeat connected function so that it constantly looks at the part?

1 Like

no its only supposed to set once.
The problem is that it does literally nothing and the model does not face the part.

Weird, I can’t see why it would be wrong. Unfortunately I can’t test it myself right now since everything is down, I’ll get back once I’m able to.

1 Like

Studio is working already, your code is fine. Is fp1 a character model or does it contain a humanoid? Because that could be messing things up

I found out my problem.
the model is a flat cylinder like a plate almost.
the front surface of the part is actually the bottom of the cylinder so it only rotates which is why I did not notice.

Now the problem is how can I compensate for that? I want to use the front of the clyinder (the top of the plate) rather than the bottom / sides

I could try to explain better if needed

1 Like

image

Here is a visual of the problem
the front surface of the part is on the bottom where the red line is
I want to use the surface where the blue dot is.

You might just be able to just multiply by a rotated CFrame like so:

fp1:SetPrimaryPartCFrame(CFrame.lookAt(fp1.PrimaryPart.Position,victim.Position)
    * CFrame.Angles(0,math.pi/2,0))

You will have to play around with where to put the math.pi/2 and whether its negative and such.

1 Like

Try messing with the angles of the CFrame:

fp1:SetPrimaryPartCFrame(CFrame.lookAt(
    fp1.PrimaryPart.Position,victim.HumanoidRootPart.Position
) * CFrame.Angles(0, math.rad(90), 0)) --90 degress converted to radians

Not sure which axis it should be but see if it actually rotates first.

1 Like