Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make an automatic fire?

Asked by 6 years ago

I have a gun that is mostly custom scripted and I am stumped to no end with how to make it automatic. I want the user to be able to hold down the mouse like most guns. Can someone please give me an example or point me in the right direction. I have played around quite a bit with some remade scripts and I don't understand how the automatic shooting aspect works at all.

2
It's a bit hard to explain, but you could have a variable set to when a player's holding down the mouse the variable's set to true, and a loop is starting for the automatic, and when the player releases their mouse, the variable is set to false, thus stopping the loop. ^^ TheeDeathCaster 2368 — 6y
0
^ Like he said you've got two events of mouse being Button1Down and Button1Up, set a bool, while the bool is true shoot the gun Vulkarin 581 — 6y
0
This is a really simple test I made in a script (not local script) to make sure I understand the mouse: tygerupercut3 68 — 6y
0
local mouse = game.Players.LocalPlayer:GetMouse() mouse.Button1Down:connect(function(destroy) game.Workspace.Baseplate:Destroy() end) tygerupercut3 68 — 6y
0
Will that work? tygerupercut3 68 — 6y

Answer this question