Jump to content

Get a Random Player Inside a Col


Z4Zy

Recommended Posts

Posted

Hi !

        Can you tell me a way to get a random player among players inside a col ? [ col refers to an area created by "createColSphere" function. ] "getRandomPlayer" function can't be use since it choose a random player from all players in the server. Any other way ?

 

  • Moderators
Posted
local playerTable = {}


local player = playerTable[math.random(#playerTable)]

https://stackoverflow.com/questions/2988246/choose-a-random-item-from-a-table

 

As extend of N3xT his comment.
 

  • Like 1
  • Thanks 1

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...