Search code examples
luacoregames

How to pick every player in a range/region?


I think I already saw it in the CoreGames tutorials but I forget it, can you tell me pls? Example image


Solution

  • You could've just Googled coregames find players in region or something similar and take a look. I immediately spotted Game.FindPlayersInSphere which you could use.

    Otherwise simply iterate through the players and check whether their position (the X/Y/Z components) fit within a box you specify, in case a sphere doesn't fit your needs.