Loading a character that a player makes into the game

I made a fully working datastored character creator and am wondering if something like this would work to load the player’s custom character into the game:

local data = game:GetService("DataStoreService")
local skinColor = data:GetDataStore("SkinColor")

if skinColor == 1 then
	script.Parent:FindFirstChild("Head").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("Torso").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperLeg").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperLeg").Color = Color3.fromRGB(108, 71, 53)
	
elseif skinColor == 2 then
	script.Parent:FindFirstChild("Head").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("Torso").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperLeg").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperLeg").Color = Color3.fromRGB(108, 71, 53)
elseif skinColor == 3 then
	script.Parent:FindFirstChild("Head").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("Torso").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperLeg").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperLeg").Color = Color3.fromRGB(108, 71, 53)
elseif skinColor == 4 then
	script.Parent:FindFirstChild("Head").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("Torso").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperArm").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("LeftUpperLeg").Color = Color3.fromRGB(108, 71, 53)
	
	script.Parent:FindFirstChild("RightUpperLeg").Color = Color3.fromRGB(108, 71, 53)
end

im not very advanced at scripting so please point out any errors

ohhh boy this is (not to be rude AT ALL) terrible.

First, DataStores’s are constructed like this:

local data = game:GetService("DataStoreService")
local datastore = data:GetDataStore("DATASTORENAME")

You don’t use “GetDataStore” for getting a Player’s save. You use it for creating a DataStore name. You get data by using

datastore:GetAsync(DATANAME, THEDATA)

I suggest watching a video on datastores!

3 Likes

what would THEDATA be? like datastore:GetAsync(DATANAME, 3)

sorry you only put the data’s name since GetAysnc on requires one argument

1 Like

so would it look like this:

if skinColor:GetAsync(skinColor) == 4 then

you have to get the players specific datastore.
please watch a tutorial on datastores

1 Like