How fast is too fast when firing a remote event?

I am working on a laser that follows the user when they click and hold.

How much should the wait() be in between each fire?

2 Likes

Could you please explain how fast the laser would be traveling at?

1 Like

You avoid script exhaustion timeouts you probably want the time in between to be 0.5 to 2 seconds. This might make it look a bit laggy but you can use the TweenService to make it look a lot smoother.

3 Likes

Sometimes for things like these, I use API that is replicated automatically. Of course some things might be impossible.

For example if you use Vector3 Value it will be automatically replicated.

If you want a more…interesting workaround you could use the inputs like throttleFloat and SteerFloat on the Vehicle seat.

1 Like

Instead of wait, you should use

game:GetService("RunService").Heartbeat:Wait() -- This will run every frame, after the physics simulation has completed

for server side scripts,
and

game:GetService("RunService").RenderStepped:Wait() -- This will run when there is a new frame via FPS

for LocalScripts.

Too fast would be

while true do
   game.ReplicatedStorage.RemoteEvent:FireServer()
end

This would break your script.
And to fix that, you would do

while true do
   game.ReplicatedStorage.RemoteEvent:FireServer()
   game:GetService("RunService").RenderStepped:Wait()
end

Don’t use wait(). Use RenderStepped:Wait() / Heartbeat:Wait()
Hope this helps!

3 Likes

This is what I mean:


The laser follows the cursor

Thanks! It’s very smooth and doesn’t produce any noticeable lag.

In my opinion I think what suits best for performance is better. I think around 1-2 seconds of delay.

My RemoteModule queues requests once it stacks over it’s base 1 second debounce, Of course it’s the default, some remotes may require lesser as it’s more dynamic, such as the Roblox Chat Remotes, Can’t debounce them otherwise they can’t sent messages instantly and that’s annoying.

But yeah, Around 1, if its a 15+ plyer game,
If it’s a 1 player game then sending remotes each .1 would be easily handled.