I’m trying to make it so that these eyes look at nearby players individually.
The problem is that the entire model is unanchored, and the eyes are welded to the base of the enemy.
This makes it so whenever I try to change the CFrame of one of the eyes, the entire model is offseted around the eye.
(Right Eye looking at 100,100,0 | Same angle)
I’ve tried to also tried to change the orientation property of the eye but for some reason when I do that the position is also affected
(C1 > Orientation | “0,0,0” → “0,-1,0”)
This is the part of my code that is supposed to rotate the eye.
It doesn’t do anything noticeable when I run it, except making the entire model glitch out and fling itself.
You cannot change the CFrame of the eyes directly due to the weld. Instead, you have to manipulate the C0 and C1 of the weld itself. Refer to this for some explanation, and let me know if you’d need some help with it. I am not the CFrame master, but I can give it a try.
It would help if you listened to what “Volieb” is saying.
Using the C0 or C1 of a weld you can manipulate the orientation of the weld’s CFrame.
It would usually look something like this
Weld.C0 = CFrame.new(-PositionVector-) * CFrame.Angles(-Type the new orientation here-)
Oh, I didn’t see Volieb’s post. Sorry about that. I will experiment with what you and Volieb said to try and get it to work. If I make any progress I’ll let you know.
Unfortunately this didn’t work either. What I did was I used CFrame.lookAt to orient the eye, then I copy and pasted the orientation (from the explorer) into the angles and it still changed the position of the eye.
Hhm, weld’s properties seem to change since a lasted used them so I can’t help much now. I would recommend looking through Devforum since I know there is a lot on weld’s C0 properties
Set the Part0 of the weld to the Head and the Part1 to the Eye.
And from now on you should tween the C1 of the weld which stands for the CFrame
of Part1
local model = workspace.Model
local eye = model.pB
local base = model.pA
local weld = base.Weld -- Part0 is base, Part1 is eye
local looking = workspace.LookAtPart
_G.stare = true
while _G.stare do
wait()
local newCF = CFrame.lookAt(eye.Position, looking.Position, Vector3.new(0,1,0))
-- weld.Part0.CFrame * weld.C0 = weld.Part1.CFrame * weld.C1
weld.C1 = newCF:Inverse()*weld.Part0.CFrame*weld.C0
end