local Player = game.Players.LocalPlayer
local character = Player.Character
local Mouse = Player:GetMouse()
local debounce = true
Mouse.Button1Down:Connect(function()
debounce = false
while true do wait() print('gg')
if debounce == true then return
end
end
end)
Mouse.Button1Up:Connect(function()
if debounce == false then
debounce = true
end
end)
This is my code and im trying to print when the mouse button is down just like a automatic gun in phantom forces shooting repedeatly im trying to print repedeatly it works but im just wondering if this is how most people do it and if its efficient

1 comment
What most people do is they use a boolean that is false, set it to true when the button is being held down and have a loop for while that boolean is true.