Is it ok to bring more code into replicatedstorage?

As I’ve been working on my game I’ve tried to be strict with what I put on the client and server, however, I’ve been thinking that maybe it’s ok to not be so strict. For example, I’m working on a class-based fighting game and my setup is 2 modules for each class one on the client that handles frontend stuff and one on the server for the backend stuff, however, it feels like it would make things a lot simpler if I just make 1 module that’s shared and runs differently depending if the client or server is using it.

Sure, If they are both non-local scripts made into one and set up to take two paths depending on placement.

If some functions are meant to be local and some are meant to be server ran, it may become confusing. If the client has no need to use the server functions, then there is no reason to give them to it. You also will be exposing the back-end code to the clients, which could be dangerous.

1 Like

I have a module that works for a server and client depending on the variable “isClient” which is ofc either true or false. And if isClient is true then the script will run slighty differently. So yes this can work

As Maxx said. Minimize the amount of code the client is able to see. It will help exploiters understand and attack your game more effectively/ efficiently. And just more in general. Which is obviously a bad thing

Yeah, sure, as long as the code doesn’t give dangerous insight to your backend. I have a lot of SerDe and data compression stuff in repstor for a game im working on because both the server and the client are gonna need to do that. It doesn’t give insight into how my game’s internals work, so it’s fine. I have levelup xp requirement and reward calculations in replicatedstorage - not the actual levels hander, just the calculations - because with how my game is structured it’s just easier to let the client have that info. Just giving them the ability to calculate how much currency they’ll get from a levelup or how much xp they need to level up is fine, they can’t really do anything with that as long as I dont put a big fat “LevelUp” function in the module where the client can see what the server does to handle levels and find ways to trick it. Stuff like that.

Can’t a person just change the calculations to their advantage?

Only on the client. Not on the server, though. So it doesn’t really matter. It would be the equivalent of going into developer tools/inspect element to change your robux. It doesn’t really change your robux lol.