I have this FAMAS gun, but I don’t know how to make it fire in burst. I’ve got this semi-automatic firing system that I can add delays to, but I don’t know how to make it fire three bullets instead of 1. Help? The code is way too big to share, so I’ll just post parts that you request to see.
To clarify: i’ve tried loops on the making the bullet part, but it just breaks the gun
You could use a simple loop like a for loop or something
local bulletPerBurst = -- how many bullets you want to fire each burst
local rpm = -- how fast the gun fires, amount per minute
for count = 1, bulletPerBurst do
-- do firing gun code here
wait(60/rpm)
end
i mean by like how do i make a loop work for my gun. i’ve found an older version of it that isn’t FE and it places the same line of code where I put it and the nonFE can shoot, but my newer version just breaks
if MyMouse then
for i = 1,12 do --shotgun effect
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
if MyMouse then
for i = 1,12 do --shotgun effect
RecoilTrack:Play()
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
Camera.CFrame = Camera.CFrame * CFrame.Angles(0.007,math.rad(0),0)
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet