Should I delete server scripts on the client?

Right now I’m looking for ways to optimize my game as much as possible (more FPS, less memory, etc.).
And yeah, I know this might sound like dumb question, but still, I’m wondering whether or not I should delete server scripts in a local script for a slight boost in performance? From what I understand, the server script should still work after getting deleted on the client, but you just can’t access it on the client.

3 Likes

Server bytecode is not sent to the client (it is executed on the server), so the server scripts you see are only empty containers that got sent because they were placed in workspace or some other replicated instance. Their presence has close to no impact on performance and memory.

1 Like

No, no, no!

  1. Even though server scripts run though they’re deleted, local scripts are still viewable to exploiters. They can use exploits to view the local script and check the path of the server script you’re deleting.

  2. It isn’t even necessary. You cannot access server scripts from local scripts since they’re hidden by default when you start playing the game.

  3. Optimize your game by making proper usage of parts to keep it in a low amount, or do benchmarks and check stuff if you need to. Deleting scripts is not a good way at all to improve optimization when the code itself keeps running.

1 Like

Scripts that only run in the server context is completely inaccessible by any client. The client’s only viewable contexts are local contexts only. These are only in concerns about security.

If you’re worried about performance, ensure you are not applying anti-patterns that would degrade your performance over time. Poorly applied code is not always the answer for bad performance too, but also maintainability and sometimes reliability. Diagnosing these kind of issues are difficult(and sometimes deceptively easy), because they sometimes appear in runtime which isn’t always predictable.

When sorting between unpredictable and predictable instances, think about this:

  • When you apply a reliable code to a reliable event, expect reliable results and therefore no additional actions needed.
  • When you apply a reliable code to an unreliable event, expect unreliable results and requiring further actions to iron out end-cases.

Other times, the performance is purely based on the graphical components and you need techniques like culling to improve performance. An optimized system may only allow clients to render while containing data on the server.

And no, you should not delete the scripts at all. This will not improve performance by any noticeable metric. It is simply micro-optimization at this point.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.