This is for a gun I'm making, but I want it to be an automatic rifle, as in it will keep shooting if you hold it down.
But I don't know how to tell if someone is.
Is there like an event or something to tell?
I use something like this: Basically you need to spawn a loop that checks if a variable called "MouseDown" is true, and when the mouse event Button1Down is called, set the variable to true, but when Button1Up is called, set the variable to false.
As long as this is in a local script it will work.
EDIT: Added a renderstepped wait to the loop
local player = game.Players.LocalPlayer; local Mouse = player:GetMouse(); local MouseDown = false; local rs = game["Run Service"].RenderStepped; -- Faster loop function MouseChecker() while true do rs:wait(); if (MouseDown == true) then print("Mouse is down"); -- repeat code here while the mouse is down end end end Mouse.Button1Down:Connect(function() MouseDown = true; end) Mouse.Button1Up:Connect(function() MouseDown = false; end) spawn(MouseChecker);