I'm trying to make a pistol, and I have no idea where to continue on from here

-- 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

1 Like

This isnt how you usually make a gun,
Look into here to get a general idea

Video 1

If you want to add guns with bullet drop, i recommend you check out this video

Video 2

ok ill check those out thanks!!

Note that a video 1 is just a simple raycast and nothing else, if you want to add stuff such rng and drop and velocity etc then i recommend you check out the video 2 as it shows you the basic of the module script that also has the features
Post

ok I’m doing video 2 thank you