So, in my game, I have a part where the player custom creates their character before starting the game. I need a way to store this into a data store because there is a "Load option" .I need the data store so that you can click the load button and get you're currency and character the same as when you left. Here are the options of the character & their code (just incase you need it!)
** Faces**
game.ReplicatedStorage.Events.FaceEvent4.OnServerEvent:Connect(function(plr)
local char = plr.Character
if char:findFirstChild("Humanoid") then
char.Head.face.Texture = "http://www.roblox.com/asset/?id=324583433"
end
end)
Clothing (both pants & shirts!)
game.ReplicatedStorage.Events.ShirtEvent2.OnServerEvent:Connect(function(plr)
local char = plr.Character -- Getting Character
char:findFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=3605712285" -- Getting Shirt Template ID
end)
** Skin Color**
game.ReplicatedStorage.Events.ColorEvent2.OnServerEvent:Connect(function(plr) -- getting on server event (ColorEvent1, ColorEvent 2 ect)
local button = game.StarterGui.CustomizeChar.Frame1.SkinColor2 -- Getting skin changing button
local q = BrickColor.new("Brown") -- Color Of Skin
local char = plr.Character
char.Head.BrickColor = q -- Getting each part of the body to chnage to q (Desierd Color of Skin)
char.UpperTorso.BrickColor = q
char.LowerTorso.BrickColor = q
char["RightLowerArm"].BrickColor = q
char["LeftLowerArm"].BrickColor = q
char["RightUpperArm"].BrickColor = q
char["LeftUpperArm"].BrickColor = q
char["LeftLowerLeg"].BrickColor = q
char["RightLowerLeg"].BrickColor = q
char["RightUpperLeg"].BrickColor = q
char["LeftUpperLeg"].BrickColor = q
char["RightFoot"].BrickColor = q
char["LeftFoot"].BrickColor = q
char["RightHand"].BrickColor = q
char["LeftHand"].BrickColor = q
end)
** & Finally Hair **
game.ReplicatedStorage.Events.HairEvent1.OnServerEvent:Connect(function(plr)
local Storage = game.ReplicatedStorage.Hair.Hair1
local char = plr.Character -- Getting Character
if char:findFirstChild("Humanoid") then
local Folder = char.Head.Hair -- Getting Hair Folder
Folder:ClearAllChildren()
local Head = char.Head -- Getting Head
local New_Hair = Storage:Clone() -- Cloning Hair
New_Hair.Parent = Folder -- 115 through 121 is welding the hair to the body
New_Hair.Position = Head.Position
local Weld = Instance.new("Weld")
Weld.Parent = New_Hair
Weld.Part0,Weld.Part1 = Head, New_Hair
Weld.C0 = CFrame.new(0,0.6,0)
Weld.C1 = Head.HairAttachment.CFrame
end
(I put the code just incase you needed it)
I looked every where and can't find a way to save these into a number or something and then save that in the data store. If you could help figure this out that would be really helpful. All I need is just a way to store this into a data store. If you have any suggestions on changing the code for one of the customizations that would also be helpful!
Thank you in advance
acuaro

12 comments
Thank you a lot, and I tested the skin color & it works. The only thing is I don't really under stand by what you mean of "get hair instance". If you could help, Thanks.
I don't really have much experience with hair and stuff, but I believe it has it's own instance, or object. So in other words, get the hair object, that's how the hair works, correct?
Oh Yeah :P, thats how it works. I'll go try it out. I'm so . dumb :P. Thank you.
Uh oh its not working, here is the code -- local save = { "Hair" = char.Head.Hair:GetChildren() }. When I hover over "Hair" it says "Expected Name, Got a Complex Expression"
I forgot, you may need to put brackets around the key of the dictionary, so it would look like this. local saves = { ['Hair'] = char.Head.Hair:GetChildren() }
Hopefully that works
I'll test it out
I'm really sorry for disturbing you more, but that dosen't seem to be working either. I tried to print the Hair (The name of the hair) but the error just said "line 9" which was the line with ['Hair'] = blah blah blah.
Sorry for the late reply. char.Head:GetChildren() returns an array of the children of Head. idk much about the hair, but why do you need all children of the characters head?
Because I'm not sure what hair the player is wearing right now
I think I understand now, perhaps it would be better to do this then. char.Head:GetChildren()[1] to indicate that you want the first (and only?) value.
Yes, That worked! Thank you