generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: What would be a good way to organize users with tables?

Previous Thread :: Next Thread 
rockintyler8alt is not online. rockintyler8alt
Joined: 17 Dec 2011
Total Posts: 25
11 Aug 2012 05:27 PM
I need to be able to add them, which I can do, but also remove them when I need to. Them being users in the game.

table.remove() only takes which number it is in the table..... all I have to reference the user is their name. >.<
Report Abuse
Brofessions is not online. Brofessions
Joined: 30 Jul 2012
Total Posts: 214
11 Aug 2012 05:32 PM
table = {["Player"] = true}
table[player.Name] = true

Set a player name value to true when their in the table

and then

table[player.Name] = false

when you want to remove it
Report Abuse
rockintyler8alt is not online. rockintyler8alt
Joined: 17 Dec 2011
Total Posts: 25
11 Aug 2012 06:12 PM
bump
Report Abuse
rockintyler8alt is not online. rockintyler8alt
Joined: 17 Dec 2011
Total Posts: 25
11 Aug 2012 08:33 PM
bump
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
11 Aug 2012 08:34 PM
...
Brofession's idea looks like it would work (though I'd use nil, not false) and you just totally ignored it.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
11 Aug 2012 08:37 PM
local PlayersList = {}

PlayersList[game.Players.Player1] = true -- This one line will add the player to the table.

for Player, _ in pairs(PlayersList) do
print(Player.Name)
end

--> Player1

PlayersList[game.Players.Player1] = nil

for Player, _ in pairs(PlayersList) do
print(Player.Name)
end

--> (Nothing prints)

So basically, use the player object itself as the index, and then just set the value to true, or nil.
Report Abuse
rockintyler8alt is not online. rockintyler8alt
Joined: 17 Dec 2011
Total Posts: 25
11 Aug 2012 08:43 PM
@Droid I didn't ignore it, I was seeking another method.
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
11 Aug 2012 08:47 PM
The easiest and most efficient method is the earlier mentioned method. Although there can be other methods, they would require a lot more scripting, and take longer to run.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image