Need help with "scanning" nearby BaseParts (or Models)

I’m looking for a way to reliably (and hopefully as lag-free as possible) check the player’s surroundings for BaseParts that contain for example a specific folder called “Values”, i have searched on forums a bit but couldn’t find a good answer. I have thought about running a [while task.wait(0.5) do] loop but i thought it would be laggy since it needs to run on the server for every single player character, which in highly populated servers might cause lag, i am not sure if it would create significant lag or not, ANY help is appreciated (References to other posts, clarifications, examples.)
Thanks!

2 Likes

workspace:GetPartBoundsInRadius()
workspace:GetPartBoundsInBox()
workspace:GetPartsInPart()
These may help! :happy3:

4 Likes

Thank you! I’ll be trying these methods soon, i still have a question though, would running one of these (preferably GetPartBoundsInRadius) for every single PLAYER character in a while loop be laggy? I’m talking about checking every 0.1 or 0.5 seconds.
(Imagining it’s a 30-50 player server)

1 Like

No problem! As to answer your question, I’m not sure if it would lag as I’ve never tried it. You can probably run it on the clients and send the data to the server though!

1 Like

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