|
| 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 |
|
|
|
| 15 Dec 2016 03:28 PM |
what's wrong with using data stores or tables?
Formerly ToxicDominator - add 30,319 posts |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 15 Dec 2016 04:10 PM |
yep dictionaries
Formerly ToxicDominator - add 30,319 posts |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|