Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Which is the fastest way to check if all players are within a certain distance?

In my game there are explosions, and in order to make it seem intense I added a screen shake, however, the screen shake can only occur if they are within a certain range (roughly 50 studs or so).

Is it quicker and less strenuous to either:

For the server to cycle through all the players and check their magnitude assuming the character exists, note that the server is already doing some heavy stuff.

OR

To use the FireAllClients() event so that the client can work out the magnitude in a LocalScript.

3 comments

0

First solution. Then fire clients to shake the screen. Prevents potential exploits. Don't worry about server doing heavy work, magnitude checks are very fast. If you are concerned, you can always keep an eye on script performance window. Anything less than 3% is ok.

0

I don't really mind the screen shake on the client side, as it's only a screen shake. Unless in terms of performance, it is better to go for the first one?

0

lol

1 answer

✓ Accepted answer

the second option is definitely better as u would have to tap into a client side script anyways to make the camera shake and as for performance, doesnt really matter honestly but client side should be still better in this context

This discussion is preserved as it was. New answers, comments, and votes are closed.