How do i make assembly linear velocity scale with magnitude?

I want to make my projectile scale with magnitude. For example the closer the mouse position is to the gun the less force it takes but it still reaches it.

Ive tried searching around but i couldnt find anything.

Another thing is when i click the skybox my projectile bugs out so i want to add some sort of limit to how far the projectile could go

My Code:

Event.OnServerEvent:Connect(function(Player, MousePos)
	
	local Duration = 1
	local Direction = (MousePos - Pistol.FirePart.Position) / Duration
	
	local Part = Instance.new("Part")
	Part.Position = MousePos
	Part.Parent = workspace
	Part.Size = Vector3.new(2,2,2)
	Part.Color = Color3.new(1, 0, 0.0156863)
	Part.Transparency = 0.4
	Part.CanCollide = false
	Part.Anchored = true

	local ShotSound = Sound:Clone()
	ShotSound.Parent = Pistol.FirePart
	ShotSound:Play()
		
	local NewBullet = Bullet:Clone()
	NewBullet.Position = Pistol.FirePart.Position
	NewBullet.Parent = workspace
	NewBullet.CanCollide = true
	
	NewBullet.AssemblyLinearVelocity =  Direction + Vector3.new(0, workspace.Gravity / 2 / Duration, 0)
	
	NewBullet:SetNetworkOwner(nil)
	
	ShotSound:Destroy()
	
end)

So i tried doing direction.magnitude but it didnt work.

boosting since no one saw this post yet

found out how to make it scale with magnitude but it still doesnt have a maximum or minimum

local Pistol = script.Parent
local Event = Pistol.BulletEvent

local Sound = Pistol.Sound
local Bullet = game.ReplicatedStorage.Bullet

local Debris = game:GetService("Debris")

Event.OnServerEvent:Connect(function(Player, MousePos)
	
	local Range = 50
	local Duration = (MousePos - Pistol.FirePart.Position).Magnitude / Range
	
	local Direction = (MousePos - Pistol.FirePart.Position) / Duration
	
	print(Duration)
	
	local Part = Instance.new("Part")
	Part.Position = MousePos
	Part.Parent = workspace
	Part.Size = Vector3.new(2,2,2)
	Part.Color = Color3.new(1, 0, 0.0156863)
	Part.Transparency = 0.4
	Part.CanCollide = false
	Part.Anchored = true

	local ShotSound = Sound:Clone()
	ShotSound.Parent = Pistol.FirePart
	ShotSound:Play()
		
	local NewBullet = Bullet:Clone()
	NewBullet.Position = Pistol.FirePart.Position
	NewBullet.Parent = workspace
	NewBullet.CanCollide = true
	
	task.spawn(function()
		task.wait(Duration)
		print("Ball Landed")
	end)
	
	NewBullet.AssemblyLinearVelocity =  Direction + Vector3.new(0, workspace.Gravity / 2, 0) * Duration
	
	NewBullet:SetNetworkOwner(nil)
	
	ShotSound:Destroy()
	
end)