What's the best way for a server script to run a loop while the mouse is held down?

Would you embed an Up RemoteEvent inside a Down RemoteEvent like this? Would the Up RemoteEvent stack?

DownRemoteEvent.OnClientEvent:connect(function(Player) local down = true

DownRemoteEvent.OnClientEvent:connect(function(Player2) if Player2 == Player then down = false end end)

while down do --BLAH BLAH BLAH end

end)

1 comment

0

Please use a code block by editing your question and clicking the blue Lua button, and by placing your code inside.