Ship flying wrong after some time flying

Hey everyone.

So I have this ship as I’m working on a game (credits to my friend for building it if you like it).

Basically, as seen in this video it flies how it’s suppose to at first:

But here we can see the first thing, whenever the mouse goes on the ship itself, it does as seen in this video. I understand from the nature of the script (see below for the script) that it’s just following where the part goes. So if there’s any better way to do this, please let me know how.

And finally the main issue, after awhile of flying, it starts going in the wrong direction as seen here:
EDIT: Videos weren’t loading, sorted it now and they should load.

local Speed = 50
	local Weight = workspace.Gravity*ss:GetMass()
	local Aimer = ss:WaitForChild("Aimer")

	ss.AlignPosition.Enabled = true


	local BodyForce = ss.BodyForce
	BodyForce.Force = Vector3.new(0,Weight,0)
	spawn(function()
		while true do

			local Target = mouse.Hit.Position



			ss.AlignPosition.MaxVelocity = Speed
			


				Aimer.Position = Target

			
			ss.CFrame = CFrame.new(ss.Position, Target)

			task.wait()

		end
	end)
1 Like

use mouse.TargetFilter (basicaly this work exactly like the blacklist thing in raycast)

1 Like

What @gamingvn132 said but I’ll add that you have to set mouse.TargetFilter to an Instance. It can’t be a table or array.

1 Like

Alright I will do, thanks. Any idea how to fix the issue in the last video?

@hkep Thanks too, luckily isn’t a table or nothing being used

also bodyforce got deprecated so you might want to use different thing like vectorfoce

Hey thanks. I got that changed now, I’m now using VectorForce.

so did it work
(Character limit)

Yeah, but the 3rd issue (last video) still exists sadly.

But, using TargetFilter fixed the 2nd issue (2nd video), and VectorForce has just made it a bit more smooth which is a added bonus

EDIT: I know for a fact that the issue is caused due to the aiming system (3rd video), aka following a part. As it normally happens once the part gets put in a awkward spot. However, I am confused on how to swap the system and or fix it with the current system.

EDIT #2: I’ve just tried using the Filter system, but on workspace so it basically ignores everything.
But my main concern now is if it’d cause any latency issues or FPS issues, as things will constantly be entering and leaving workspace, plus there will have a lot of stuff in workspace.
Do you have any idea by chance? @gamingvn132

From what I remember parent and unparent stuff from workspace can cause memory issue