So I used CFrame.new(the eye's position, the torso's position)
to make the eye 'stare' at the player but I want the eyes to have limits, if you stand behind the eyes they won't be able to look at you. So how?
You could try something like this:
local min = -90 local max = 90 while wait() do local cf = CFrame.new(eye.Position,torso.Position) local angles = {cf:toEulerAnglesXYZ()} local newAngles = {} for i,v in pairs(angles) do if math.deg(v) < min or math.deg(v) > max then newAngles = {0,0,0} break else newAngles[i] = v end end eye.CFrame = CFrame.new(eye.Position) * CFrame.Angles(unpack(newAngles)) end
Not sure if toEulerAngles returns radians or degrees, so you might have to use math.rad on the new angles, but something like this might work.