Gun full auto scripts

hi I’m currently making guns and I was wondering what’s the best way to make the gun full auto. Like what type of code should I use

You can use something similar to this

local mousedown = false
local mouse = game.Players.LocalPlayer:GetMouse()
local cadence = 0.05


mouse.Button1Down:Connect(function()
if equipped and not mousedown then -- Just adding to see if the gun is equipped, add a variable and equipped event
if ammo > 0 then -- ammo, you can set ammo variable or int value, numbervalue
if not reloading then -- checking if the gun isn't reloading, make a variable
mousedown = true
repeat 
shot() -- make shooting a function
wait(cadence)
until not mousedown or ammo < 1 -- basically, if the player is not longer holding the mouse left click!
end
end
end
end)
mouse.Button1Up:Connect(function()
if not reloading then
mousedown = false
if ammo < 1  then -- 
reload() -- make reload a function
end
end
end)
1 Like

The solution above works (Although I would recommend using UserInputService instead).

Another option can be found here: UserInputService | Documentation - Roblox Creator Hub

1 Like