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
 

Re: How to save a players custom apperance?

Previous Thread :: Next Thread 
ApocSurrvivalist is not online. ApocSurrvivalist
Joined: 22 Apr 2013
Total Posts: 5840
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
DeathsLASTwords is not online. DeathsLASTwords
Joined: 28 Jan 2012
Total Posts: 2701
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 is not online. 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
ApocSurrvivalist is not online. ApocSurrvivalist
Joined: 22 Apr 2013
Total Posts: 5840
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 is not online. 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
UnderWorldOnline is not online. UnderWorldOnline
Joined: 31 Dec 2010
Total Posts: 7883
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 is not online. 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
UnderWorldOnline is not online. UnderWorldOnline
Joined: 31 Dec 2010
Total Posts: 7883
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 is not online. 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
UnderWorldOnline is not online. UnderWorldOnline
Joined: 31 Dec 2010
Total Posts: 7883
20 Sep 2015 10:44 AM
@Stymi

Thanks for the help!
Report Abuse
ApocSurrvivalist is not online. ApocSurrvivalist
Joined: 22 Apr 2013
Total Posts: 5840
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
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