Remote Event Delay

I am using a .touched event that activates a remote event to turn off CanTocuh on that part but I have discovered there is a delay between when the event gets fired so the part actually gets multiple touched requests and fires the server multiple times. Now I tried to make a debounce where once it ran all the code on the client side it would call a remote event back to the server side script to turn off the debouce but it does not work so what would be the most effective way to solve this?

1 Like

Maybe listen for the touched event on the server? Remote functions have to send data over the clients network.

1 Like

So how I have it is that its in a for loop for each gem in a level so when it is touched it sends a remote function to a local script to turn off cantouch but because of the delay it happens multiple times.

1 Like

I also tried a debounce of like 0.3 seconds it mostly worked but based on how good the clients wifi is and if they stay in the part after they got touched the touched event would fire twice or up to 8 times. It works if I put the debouce to 1 second but then if there were two gems right next to each other they would not be able to just walk through them they would have to wait. So if I ever made a level where you need to jump down a hole and while they’re falling they touch gems it would not work.

1 Like