yoolurs
(yoolurs)
July 20, 2021, 12:27am
#1
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!
2 Likes
Arminius8
(Arminius8)
July 20, 2021, 12:44am
#2
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
yoolurs
(yoolurs)
July 20, 2021, 12:45am
#3
no its only supposed to set once.
The problem is that it does literally nothing and the model does not face the part.
Arminius8
(Arminius8)
July 20, 2021, 12:48am
#4
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
Arminius8
(Arminius8)
July 20, 2021, 12:53am
#5
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
yoolurs
(yoolurs)
July 20, 2021, 12:53am
#6
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
yoolurs
(yoolurs)
July 20, 2021, 12:55am
#7
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.
Arminius8
(Arminius8)
July 20, 2021, 12:57am
#8
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
Fusionet
(Fusionet)
July 20, 2021, 12:58am
#9
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