How can I fire a function repeteadly while mousebutton1 is holding down, and stop it when it stops to be holden?
I've tried a few thing, none working.
Sorry about the grammar mistakes :P
First of all, make sure you're using a Local Script.
This code should work:
local mouse = game.Players.LocalPlayer:GetMouse() local mousdwn = false Mouse.Button1Down:connect(function() mousdwn = true spawn(function() Mouse.Button1Up:wait() mousdwn = false end) while mousdwn do -- recurring code wait() end end)
EDIT: Almost gave you the loop of death. :P
Marked as Duplicate by Shawnyg
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?