What's a good way of scripting for things to not be laggy and not hackable

client and server This is a projectile I made, the reds are client-side and when they hit they all are together, The green ones are server-side and all of them are spread out differently cause of lag, its a big pain.

I originally wanted all my abilities to be server-side as they will be harder to hack, but It seems I’ll have to load them client-side now because it’s laggy for people.

Does anyone know a good way around this lag?

1 Like

Not as far as I’m aware, but maybe someone much more experienced dealing with Roblox physics could chime in.

As far as I know server-side physics is always really laggy, so if you’re relying on that for projectiles you’ll encounter issues almost no matter what, unless you’re not relying on physics too much.

You could also look into this article:

But I don’t really think it helps you prevent hacking, it just lets you set the client who has to calculate the physics through the server. Correct me if I’m wrong of course, since I haven’t looked much into it. It could be possible this is what you’re looking for.

All things considered though, hacking isn’t really something we have that much power to prevent. You’ll have to have confidence in Roblox’s ability to prevent it, because either way hackers will find a way around your efforts to stop them if given reason to do so.

1 Like

This may help you

It could be difficult to do, but the best way to do not-laggy looking projectiles while also making it secure is to make the server do a raycast or validation code to get the “real” target, and have each client do a local projectile.

So for example, have the server send out a projectile that’s invisible which actually does the hit detection, and using a remote event, each client creates a dummy projectile that follows the invisible server projectile (using a BodyPositionConstraint or TweenService for example.) This way you get the server-side validation that can’t be exploited easily (as long as you make the invisible projectile’s network owner the server) with client side smooth animation.

3 Likes

Thank you, this was very helpful.