[HELP] Disabling Vehicle with Different Player in It

Hello, I am fairly new to fiveM development so spare me if I make a few mistakes but the problem I’m having with my script is that I can’t seem to get the vehicle to stop if an actual player is in the driver’s seat. When there is an AI ped in the driver’s seat I can disable the vehicle but when another player is driving I can’t seem to disable it while they are driving.

function VehicleDisabler(entity)

	local player = PlayerId()
	local ped = GetPlayerPed(-1)
	
	if IsPlayerFreeAiming(player) then 	
		if IsPedShooting(ped) then	
			if DoesEntityExist(entity) then
				if IsEntityAVehicle(entity) then
					
						print('Shooting at car')

						SetVehicleEngineHealth(entity, 0)
						SetVehicleEngineOn (entity, false, true, true)
						SetVehiclePetrolTankHealth(entity, 0)
						SetVehicleUndriveable(entity, true)
						
				elseif IsEntityAPed(entity) then
				
					if IsPedInAnyVehicle(entity, true) then
					
						local car = GetVehiclePedIsIn(entity, false)

							SetVehicleEngineHealth(car, 0)
							SetVehicleEngineOn (car, false, true, true)
							SetVehiclePetrolTankHealth(car, 0)
							SetVehicleUndriveable(car, true)

							print('Shooting at car with ped')	
							
					else 
							print('Shooting at ped')	
							
					end	
				end
			end	
		end	
	end
end

Expected Outcome-When the player shoots at a car the bullet disables the vehicle even when another player is driving it.

Solved: I got the ID of the player in the car by using these two natives local target = GetPlayerServerId(NetworkGetEntityOwner(entity)) after that I triggered a server event that had an argument which I plugged my target variable into then that server event would trigger a different client event against the target players vehicle