|
| 20 Sep 2015 09:23 AM |
| maybe with string values number values bool values and load apperance someone give me a good way please. thanks |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 10:08 AM |
If you wanted it with string values you would do something like this, or just values in general( This is a beginner method for you, read everything in the post!)
http://www.roblox.com/Forum/ShowPost.aspx?PostID=171790286 |
|
|
| Report Abuse |
|
|
Stymi
|
  |
| Joined: 19 Sep 2015 |
| Total Posts: 1077 |
|
|
| 20 Sep 2015 10:10 AM |
Hi. You can save a player's custom appearance by saving a table to a datastore.
For example, take this SetAsync call:
PlayerData:SetAsync(player.userId, {player.Data.Shirt.Value, player.Data.Pants.Value})
|
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 10:18 AM |
btw i already have a data store how about when the player joins it checks for the string values and assigns clothes and so on
My names apoc halp |
|
|
| Report Abuse |
|
|
Stymi
|
  |
| Joined: 19 Sep 2015 |
| Total Posts: 1077 |
|
|
| 20 Sep 2015 10:21 AM |
Alright, for this you're going to want to remember the positions you saved the data at.
So let's take our previous example, shown here: PlayerData:SetAsync(player.userId, {player.Data.Shirt.Value, player.Data.Pants.Value}) Now, to load this in, we'd do something like this in PlayerAdded: local newPlayerData = PlayerData:GetAsync(player.userId) if newPlayerData then player.Data.Shirt.Value = newPlayerData[1] player.Data.Pants.Value = newPlayerData[2] end And so on! |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 10:38 AM |
Stymi, would that look something like this if used to save and load a player's current clothing upon joining and entering?
game.Players.PlayerRemoving:connect(function(player) PlayerData:SetAsync(player.userId, {player.Data.Shirt.Value, player.Data.Pants.Value}) end)
game.Players.PlayerAdded:connect(function(player) for k = 1, 60, 0.03 do wait() PlayerData:SetAsync(player.userId, {player.Data.Shirt.Value, player.Data.Pants.Value}) local newPlayerData = PlayerData:GetAsync(player.userId) if newPlayerData then player.Data.Shirt.Value = newPlayerData[1] player.Data.Pants.Value = newPlayerData[2] end end end)
|
|
|
| Report Abuse |
|
|
Stymi
|
  |
| Joined: 19 Sep 2015 |
| Total Posts: 1077 |
|
|
| 20 Sep 2015 10:39 AM |
| I use a DataReady bool value, it makes everything easier. This way, you know everything in the player is loaded. Simply create it at the end of PlayerAdded and check for it in the rest of the game. |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 10:42 AM |
@Stymi
My apologizes in advance. Datastore is one of my weak points.
So I think this may work, but i'm not completely certain.
PlayerData = script.Data --Save to value
game.Players.PlayerRemoving:connect(function(player) PlayerData:SetAsync(player.userId, {player.Data.Shirt.Value, player.Data.Pants.Value}) end)
game.Players.PlayerAdded:connect(function(player) wait()
local newPlayerData = PlayerData:GetAsync(player.userId) if newPlayerData then player.Data.Shirt.Value = newPlayerData[1] player.Data.Pants.Value = newPlayerData[2]
PlayerData:SetAsync(player.userId, {player.Data.Shirt.Value, player.Data.Pants.Value})
end end)
|
|
|
| Report Abuse |
|
|
Stymi
|
  |
| Joined: 19 Sep 2015 |
| Total Posts: 1077 |
|
|
| 20 Sep 2015 10:43 AM |
PlayerData would be defined like this.
local DataStoreService = game:GetService("DataStoreService")
local PlayerData = DataStoreService:GetDataStore("PlayerData")
You don't need a wait() at the start of PlayerAdded, and just leave the SetAsync call to PlayerRemoving and game.OnClose. |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 10:44 AM |
@Stymi
Thanks for the help! |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 10:54 AM |
Stymi couldnt you just do this? game.Players.PlayerAdded:connect(function(player)
local Data = player:WaitForChild("Data") local ShirtID = Data:FindFirstChild("ShirtID") Shirt = Instance.new("Shirt",Player) Shirt.Texture or whatever it's called = ShirtID.Value end
My names apoc halp |
|
|
| Report Abuse |
|
|