Gun Bullet Velocity(need help)

I don’t have any experience in velocity or mouse direction, I tried to do the script myself from base knowledge, but failed. Is there a specific parameter or order, so that I can script the direction of the bullet? Mouse’s position, not raycast

local bullets = game:GetService("Workspace").GunGiver.Bullets.Bullet
local gun = script.Parent
local plrs = game:GetService("Players")
local player = gun.Parent.Parent
print(player.Name.. " has a gun")
local mse = game:GetService("MouseService")
local mouse = player:GetMouse()
local deb = true
local difference = 0.2
mouse.Button1Down:Connect(function()
	
	if deb == true then
		deb = false
	
		local newBullet = bullets:Clone()
		newBullet.Parent = game:GetService("Workspace")
		newBullet.Position = gun.Handle.Part.Position
		newBullet.Velocity = Vector3.new(gun.Handle.Part.CFrame.p, (mouse.Hit.p - gun.Handle.Part.CFrame.p)).unit*300
		wait(difference)
		deb = true
		
	
	end

	
	
end)
2 Likes

I prefer to use TweenService in this situation.

Can you give a line of script? Just a line so I understand where you are coming from?

local cannonShot = cannonBalls:FindFirstChild("BlackpowderShot"):Clone() --the choosen bullet model
cannonShot.Parent = workspace
cannonShot:PivotTo(cannon.Union.CFrame)
for i,v in pairs(cannonShot:GetDescendants()) do
	if v:IsA("ParticleEmitter") or v:IsA("PointLight") then
		v.Enabled = true
	end
end
local distance = (endPoint - BarrelPoint.Position).Magnitude
local speed = 400 --studs.sec
local timeToTravel = distance/speed
local info = TweenInfo.new(timeToTravel, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local prop = {Position = endPoint}
local tween = TweenService:Create(cannonShot.PrimaryPart,info,prop)
tween:Play()
tween.Completed:Wait()
--call a function here which does the rest of the damage
cannonShot:Destroy()