Basically, I created a script that randomizes the Character's Hat, Face, Skin Color and Clothes upon joining. I have saved all those things using Data Stores, but now, how do I load?
I'm aware that only Values can be saved, so that's what has been saved. How in the world do I apply those values back to the Character when loaded?
Some code:
Shirt1 = "rbxassetid://663700531" --boy match fix Shirt2 = "" --boy match Shirt3 = "rbxassetid://591071428" --boy match fix Shirt4 = "rbxassetid://1117724220" --boy match fix Shirt5 = "rbxassetid://1953856302" --boy match fix Shirt6 = "rbxassetid://943047235" --boy single Shirt7 = "rbxassetid://942999747" --blue tunic single --male hair local TreckyHair = 32278814 --boy human local ChestnutStyle = 212967757 --boy human local Shaggy = 417457139 --boy human local StylishBrownHair = 62743701 --boy human local ChestnutSpikes = 80922374 --boy human local Beard1 = 158066137 --boy human local BeautifulHair = 16630147 --boy human
[ A bunch of IDs, these are the IDs that can be potentially randomized onto the Player. ]
local Shirt = Instance.new("Shirt") local Pants = Instance.new("Pants") local DataStoreService = game:GetService("DataStoreService") local CharacterStore = DataStoreService:GetDataStore("CharacterStore") local CharacterData = {} CharacterData.ShirtTemplate = player.Character:FindFirstChildOfClass("Shirt").ShirtTemplate CharacterData.PantsTemplate = player.Character:FindFirstChildOfClass("Pants").PantsTemplate CharacterData.Face = player.Character.Head.face.Texture CharacterData.SkinColor = player.Character.Head.BrickColor CharacterData.Hair = player.Character:FindFirstChildOfClass("Accessory") CharacterStore:SetAsync(player.UserId,CharacterData)
:GetAsync
If you want to load the datastore
CharacterStore:SetAsync(player.UserId,CharacterData)
You would do
data = CharacterStore:GetAsync(player.UserId)
<3 Hope this helped!