Bullet wont move

I’m trying to make some guns for a game im making, and I’m having this error when I try to shoot. The bullets aren’t moving forward.
Here’s my script.

wait()

local Weapon = script.Parent.Parent
local Sounds = Weapon:FindFirstChild("Sounds")

local Player = Weapon.Parent.Parent

local Events = Weapon:FindFirstChild("Events")

local Anims = Weapon:FindFirstChild("Animations")

local Config = Weapon.Configuration

local RS = game:GetService("ReplicatedStorage")
local Bullet = RS.Bullet

local TS = game:GetService("TweenService")

Events.Shoot.OnServerEvent:Connect(function(player, mousePosition)
	print("Shoot event connected")
	if Config.Ammo.Value > 0 then
	Sounds.Shoot:Play()
	Config.Ammo.Value -= 1
	
	local CurrentBullet = Bullet:Clone()
	CurrentBullet.Parent = workspace
	CurrentBullet.Position = Weapon.Barrel.Position
	CurrentBullet.Damage.Value = Config.Damage.Value
	CurrentBullet.Player.Value = Player.Name
	print("bullet made")
	
	local BulletGoal = {}
	BulletGoal.CFrame = CFrame.new(CurrentBullet + mousePosition)
	BulletGoal.Velocity = 400
	BulletGoal.Transparency = 0.5
	BulletGoal.Color = Color3.new(1, 0.635294, 0)
	print("Goal made")
	
	local tweeninfo = TweenInfo.new()
	local tween = TS:Create(CurrentBullet, tweeninfo, BulletGoal)
	
	tween:Play()
	print("Tween played")
	
	wait(Config.Firerate.Value)
	
	end
end)

Events.Reload.OnServerEvent:Connect(function()
	if Config.Ammo.Value < Config.Magazine.Value then
		Sounds.Reload:Play()
		wait(Config.Reload.Value)
		Config.Ammo.Value = Config.Magazine.Value
	end
end)

Example vid:

You haven’t filled out your TweenInfo, and you’re trying to add an Instance with a Position.

Code:

wait()

local Weapon = script.Parent.Parent
local Sounds = Weapon:FindFirstChild("Sounds")

local Player = Weapon.Parent.Parent

local Events = Weapon:FindFirstChild("Events")

local Anims = Weapon:FindFirstChild("Animations")

local Config = Weapon.Configuration

local RS = game:GetService("ReplicatedStorage")
local Bullet = RS.Bullet

local TS = game:GetService("TweenService")

local bulletSpeed = 8

Events.Shoot.OnServerEvent:Connect(function(player, mousePosition)
	print("Shoot event connected")
	if Config.Ammo.Value > 0 then
		Sounds.Shoot:Play()
		Config.Ammo.Value -= 1

		local CurrentBullet = Bullet:Clone()
		CurrentBullet.Anchored = true
		CurrentBullet.Position = Weapon.Barrel.Position
		CurrentBullet.Damage.Value = Config.Damage.Value
		CurrentBullet.Player.Value = Player.Name
		CurrentBullet.Parent = workspace

		print("bullet made")

		local BulletGoal = {}
		BulletGoal.Position = mousePosition
		BulletGoal.Velocity = 400
		BulletGoal.Transparency = 0.5
		BulletGoal.Color = Color3.new(1, 0.635294, 0)
		print("Goal made")

		local tweeninfo = TweenInfo.new((Weapon.Barrel.Position - mousePosition).Magnitude / bulletSpeed, Enum.EasingStyle.Linear)
		local tween = TS:Create(CurrentBullet, tweeninfo, BulletGoal)
		tween:Play()
		tween.Completed:Wait()
		
		print("Tween played")
		
		CurrentBullet:Destroy()
	end
end)

Events.Reload.OnServerEvent:Connect(function()
	if Config.Ammo.Value < Config.Magazine.Value then
		Sounds.Reload:Play()
		wait(Config.Reload.Value)
		Config.Ammo.Value = Config.Magazine.Value
	end
end)

I copied the code and put it into my script, but now the bullet is just in the air not moving

Sorry, I don’t have time to finish it right now, but this tutorial should help. I most likely did something wrong with the code though, but it should be fairly easy to fix.

Seems you’re using the CurrentBullet instance as a param for your bulletGoal CFrame. You can see in the logs it’s throwing an error as you’re trying to add it with the mousePosition. Would suggest replacing it with the bullet CFrame.Position.

I rewrote my orginal script like this:

wait()

local Weapon = script.Parent.Parent
local Sounds = Weapon:FindFirstChild("Sounds")

local Player = Weapon.Parent.Parent

local Events = Weapon:FindFirstChild("Events")

local Anims = Weapon:FindFirstChild("Animations")

local Config = Weapon.Configuration

local RS = game:GetService("ReplicatedStorage")
local Bullet = RS.Bullet

local TS = game:GetService("TweenService")

Events.Shoot.OnServerEvent:Connect(function(player, mousePosition)
	print("Shoot event connected")
	if Config.Ammo.Value > 0 then
		Sounds.Shoot:Play()
		Config.Ammo.Value -= 1

		local CurrentBullet = Bullet:Clone()
		CurrentBullet.Parent = workspace
		CurrentBullet.Position = Weapon.Barrel.Position
		CurrentBullet.Damage.Value = Config.Damage.Value
		CurrentBullet.Player.Value = Player.Name
		print("bullet made")

		local BulletGoal = {}
		BulletGoal.Position = CurrentBullet.CFrame.Position + mousePosition
		BulletGoal.Velocity = 400
		BulletGoal.Transparency = 0.5
		BulletGoal.Color = Color3.new(1, 0.635294, 0)
		print("Goal made")

		local tweeninfo = TweenInfo.new()
		local tween = TS:Create(CurrentBullet, tweeninfo, BulletGoal)

		tween:Play()
		print("Tween played")

		wait(Config.Firerate.Value)

	end
end)

Events.Reload.OnServerEvent:Connect(function()
	if Config.Ammo.Value < Config.Magazine.Value then
		Sounds.Reload:Play()
		wait(Config.Reload.Value)
		Config.Ammo.Value = Config.Magazine.Value
	end
end)

but got : 17:38:05.318 TweenService:Create property named ‘Velocity’ cannot be tweened due to type mismatch (property is a ‘Vector3’, but given type is ‘double’) - Server - ServerHandler:40

I think you have to set the “Velocity” property like this:

Bullet.Velocity = Vector3.new(400,400,400)