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 » Scripters
Home Search
 

Best place to attach information about players?

Previous Thread :: Next Thread 
fireflame09225 is not online. fireflame09225
Joined: 04 Jan 2010
Total Posts: 1818
15 Dec 2016 03:26 PM
Where's the best place to attach information about players? (Ex: a StringValue) Like if I wanted to store information that gives the player's faction out of, let's say 3 factions, where should I store it?

Normally I would just attach it to a folder in game.Players.Player1 and call it good, but I'm not exactly certain what good programming practices are in this case.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Dec 2016 03:28 PM
what's wrong with using data stores or tables?

Formerly ToxicDominator - add 30,319 posts
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
15 Dec 2016 03:31 PM
tables, but if you want physical objects to store data, I'd store them directly inside the player or in replicated storage or server storage
Report Abuse
fireflame09225 is not online. fireflame09225
Joined: 04 Jan 2010
Total Posts: 1818
15 Dec 2016 03:38 PM
I'm not really certain on how to properly use tables or data stores to do this. Do you know of a good tutorial explaining it?
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Dec 2016 03:39 PM
you can use a table with the player object or name as the key and another array as the value

Formerly ToxicDominator - add 30,319 posts
Report Abuse
fireflame09225 is not online. fireflame09225
Joined: 04 Jan 2010
Total Posts: 1818
15 Dec 2016 03:42 PM
What do you mean by using another array as the value? So what I could do it, Factions = {["Fireflame09225"] = "Faction 1"} ?? And then use the ################ to save the data for the next time they enter?
Report Abuse
fireflame09225 is not online. fireflame09225
Joined: 04 Jan 2010
Total Posts: 1818
15 Dec 2016 03:43 PM
Data Store Service
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Dec 2016 03:49 PM
local data = {}

game:GetService("Players").PlayerAdded:connect(function(player)
data[player.Name] = {faction1 = "", faction2 = "", faction3 = ""}
end)

game:GetService("Players").PlayerRemoving:connect(function(player)
data[player.Name] = nil
end)

Formerly ToxicDominator - add 30,319 posts
Report Abuse
fireflame09225 is not online. fireflame09225
Joined: 04 Jan 2010
Total Posts: 1818
15 Dec 2016 03:58 PM
Ohhh I get it! So this is another example of Dictionaries, yes? Or is this something completely different?
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
15 Dec 2016 04:10 PM
yep
dictionaries

Formerly ToxicDominator - add 30,319 posts
Report Abuse
dudefun1234 is not online. dudefun1234
Joined: 21 Jul 2013
Total Posts: 3038
15 Dec 2016 04:22 PM
I like to make a little folder for my players if they need a custom inventory too.

Everytime a player joins, make a folder with his name on it and put it in Lighting. When he leaves, make it delete itself.

This way you can have external values accessible to scripts that do not include the table that you guys are talking about.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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