The ship should be going straight when the fake mouse is at the center of the screen however it going slightly downward if you move the mouse up less than a certain amount.
RunService.Stepped:Connect(function()
local mouseDelta = UserInputService:GetMouseDelta()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
if mouseDelta.Magnitude > 0 then
fakeMouse.Position = UDim2.new(0.5,fakeMouse.Position.X.Offset + mouseDelta.X,0.5,fakeMouse.Position.Y.Offset + mouseDelta.Y)
else
local distance = fakeMouse.AbsolutePosition.Magnitude
fakeMouse.Position = UDim2.new(0.5,fakeMouse.Position.X.Offset - (fakeMouse.Position.X.Offset * mouseForce/distance),0.5,fakeMouse.Position.Y.Offset - (fakeMouse.Position.Y.Offset * mouseForce/distance))
end
local absolutePosition = fakeMouse.AbsolutePosition
local absoluteSize = fakeMouse.AbsoluteSize
local length = 500
local unitRay = Camera:ScreenPointToRay(absolutePosition.X, absolutePosition.Y)
local rayDirection = Ray.new(unitRay.Origin, unitRay.Direction * length).Direction
rayDirection *= 100
if mouseDelta.Magnitude > 0 then
ship.Part.AlignOrientation.CFrame = CFrame.lookAt(ship.Part.Position,rayDirection)
lastLook = ship.Part.AlignOrientation.CFrame
else
ship.Part.AlignOrientation.CFrame = ship.Part.CFrame
end
local targetPos = Camera:WorldToScreenPoint(ship.AimPart.CFrame.Position)
target.Position = UDim2.new(0,targetPos.X,0,targetPos.Y)
part.Position = rayDirection/100
end)