How would I make a charging feature with RemoteEvents?

Hey! I want to make a charging feature, where if the user keeps pressed a mouse button/tool that he has in his inventory, then what this will do is that it will use a RemoteEvent for the server and this will make a block to increase its size while he is pressing the mouse. However, when you stop pressing the mouse, then the block will stop increasing its size and will stay where it was.

It sounds easy, but remember that I’m talking about RemoteEvents, so it must be passed from the client to the server (and I think you can’t use the UserInputService/mouse on the server if you pass it as a parameter).

I have tried to figure out how to do this but have not come up with a solution (I am not asking for code, but for instructions or ways to do it).

fire the emote once when the mouse button is pushed down, this tells the server to start increasing the size. When the mouse is detected as being let up, fire it again with different parameters that tell the server to stop changing the part.

1 Like

Other answers from other communities, but are kinda the same solution:

Here is what I think you should do:

  • The remote event will take one boolean parameter (for start/stop)
  • On the server, make a variable that will change when the event is fired
  • Make a while loop (or runservice event) that checks that variable, then increases the block size if it’s true (edited)

so
u can do that when he press
it fires
and in the remote theres a loop repeat wait() until plar.character:findfirstchild(“StoppedHolding”) and a inputended event that fires remote that instances “StoppedHolding” inside the char
oh and after the repeat loop u destroy the StoppedHolding