How do I protect my ranged weapon?

Hello, everyone!
I have been looking for answer on how to protect my ranged weapos.
My current issue is exploiter can cause lags for clients.
So I have flying bullets and blood splashes and they are client sided since server would die.
The problem is that right now exploiter can just fire RemoteEvent with required arguments and lag users.
What can I do with that?

Option 1.
Secure your remoteevents

Option 2.
Add a maximum amount of blood/particles/whatever at the same time on the client

That’s what I am asking for, but I am not sure how.

That’s some kinda of a solution, but blood still will appear from nowhere.

Can you send a picture of the localscript/serverscript that handles these particles?

One simple way to secure your remote event is to add a server-sided debounce so that when an exploiter tries to spam remotes, nothing happens.

Read more here: Debounce Patterns | Documentation - Roblox Creator Hub

There’s a module which exists to help you easily implement debounces across your game, I can’t seem to find it right now though.

Edit: Found it DebounceLib - create debounces for events easily
Edit2: Above module looks really overly complicated… maybe create your own debounce module instead (or just forget the module and create the debounce in the script)

Can I send arguments that it requires? Since I don’t want to leak my script

Just post the portions that handle the remoteevents.

So there are 2 remotes. First one to handle weapon firing, second one is for blood emiting on client side.
When I fire weapon firing remote I give it bullet’s starting position and velocity. So everything that server needs to do is just :FireAllCleints(position, velocity) and then client simulating flying bullet.
Blood splatter works the same way, I give hit position and I give direction (in order to leave splashes on walls).

Hello, first of all thank you so much for linking my module. This is definitely what I intended it to be used for.

Onto the usage, I assure you its not complicated at all:

local DebounceLib = require(<path to module>).init();

DebounceLib:CreateEvent(<RemoteEvent here>, 1):Connect(function()
    print("This will print every second at maximum!");

Thank you for help guys, but I just found my own solution. So I am going to check how far bullet ans blood is going to be casted and each time when person fires the remote I will remove one bullet from his gun. If there is no bullets my local script won’t allow user to shoot, but if it is an exploiter I am just going to drop his request.

1 Like