-- Config
local ammo = 6
local bulletSpeed = 100
local spread = 0.02
local bullets = 1
local burst = false
local burstCooldown = 0.5
local burstRate = 3
local gun = script.Parent.Parent
local reload = false
local reloadTime = 3
local Shootsound = script.Parent.ShootSound
local Reloadsound = script.Parent.ReloadSoundSound
local Gun = script.Parent
local bullet = Instance.new("Part")
bullet.Color = Color3.fromRGB(255, 255, 0)
bullet.Material = "Neon"
bullet.CanCollide = false
bullet.Anchored = true
bullet = Instance.new("Part")
bullet.Name = "Bullet"
bullet.Parent = script.Parent.Handle
bullet.Anchored = false
bullet.Velocity = Vector3.new(bulletSpeed,0,0)
I’m new too velocity so please correct me if I messed up the velocity. Currently the gun doesn’t shoot because I’m not sure how to make something happen when the player clicks while holding a tool.
When I run the script, I get this error
pistol is not a valid member of Tool “Players.HudDun2012.Backpack.Pistol”
The gun also does not reload and I’m not sure how to make it reload.
Please, if you can, help me