This error is occurring because The “Y” is a sub-category of a part’s rotation and therefore is read only. Instead, you need to update the whole position. Try this script:
〃〃〃lua
local Target = game.Workspace:WaitForChild(“Target”)
local target = game.Workspace:WaitForChild("Target")
local runservice = game:GetService("RunService")
function CFrameToOrientation(cf: CFrame)
local rx, ry, rz = cf:ToOrientation()
return Vector3.new(math.deg(rx), math.deg(ry), math.deg(rz))
end
runservice.Heartbeat:Connect(function()
local lookatCFrame = CFrame.lookAt(script.Parent.Position, target.Position)
local y = CFrameToOrientation(lookatCFrame).Y
script.Parent.Orientation = Vector3.new(script.Parent.Orientation.X, y, script.Parent.Orientation.Z)
end)
This will make the script’s parent face the target for only the Y axis.
Hope it helps!