I want to achieve in making an only Y Axis aimbot script. Pretty much aimbot but only for the up and down axis. The issue is that I can’t get it to do the right thing. I got help from discord and I fiddled with it using negative CFrames. Here is as close as I have to an aimbot Y axis on enemy:
-- Face Enemy with Camera on Y-Axis.
local function FaceTarget()
local Enemy = FindTarget()
if Enemy then
-- Auto adjust Enemies Y axis
print(Enemy.Parent)
local direction = -(Enemy.Position - Camera.CFrame.Position)
local XZ = Vector3.new(1,0,1)
local directionToLookAt = Camera.CFrame.Position + Camera.CFrame.LookVector * (direction * XZ).Magnitude + Vector3.new(0,direction.y,0)
print(directionToLookAt)
Camera.CFrame = CFrame.lookAt(Camera.CFrame.Position, directionToLookAt)
else -- No Enemy
-- Return Camera back to normal original spot
-- Camera.CFrame = CFrame.new(0,0,0)
end
end
RunService.RenderStepped:Connect(FaceTarget)
Enemy is the enemies’ HumanoidRootPart