Preventing shop spam buying

Hey there developers!

What a fine day it was for me, but as always I encountered an issue, that’s fine, we can fix it!

As I’m only now getting serious when it comes to scripting, I have a passion to learn everything I can about learning how to secure my games as much as I can early on. I’ve been an exploiter years ago, so I know what they can do; even the most popular and well developed games can’t exactly secure everything.

I have made a small practice project, learning and making a shop system. Very basic, nothing fancy. I have a shop keeper with a proximity prompt attached to it, a server script listens to the service and checks which prompt was triggered and if it was from the shop keeper, it fires some remote events towards the client that triggered it so it can open the GUI… pretty standard stuff.

It all works, the cash system works. The only thing that doesn’t work is the fact that the user can spam the shop, buying items whenever they wanna (as long as they have enough cash for it). So what do you do about this? You introduce a debounce variable. But wait, hold up, the whole script that handles buying is a server script. If I add a debounce var there, it will affect all players, which ruins the experience. Doing it on a LocalScript wont work, it can be exploited, so what’s the best way to prevent shop spam? Got any ideas? Hopefully!

– Happy coding

i guess you can make a local script that has debounce and fires a remote event and the server script handles the buying

1 Like

You can use a table debounce so only that player spamming will be affected rather than everyone

2 Likes

Don’t implement the debounce on the client side, exploiters can easily change LocalScripts there & fire the event multiple times

1 Like

Seems like this answer makes the most sense. I’ve looked into it, it also incorporates os.time() or tick() whichever, and seems to be doing what I really want it to. Thanks for the idea! Wouldn’t have came up with it on my own :slight_smile:

1 Like

Glad to be of help with giving you the idea, I hope you can keep remembering it when you have to incorporate a debounce system that only affects a certain player rather than everyone!

If you have anymore issues don’t be afraid to make another post!

1 Like

SECURE YOUR REMOTES EVENTS AND FUNCTIONS!! this is the most important part, you can check how many times a remote is fired or requested to fire and proceed to take action.

1 Like

I’m fully aware bud, broke my ear drums with those caps sheeesh haha. Thanks anyways!

1 Like

Lol, sorry I just want you to know how important this is sorry 4 caps.

1 Like