Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can is save skin color with Datastore?

Im trying to save the players skin color in DataStore but i can't get it to work because im always getting black color but my color was brown when i saved, here is what i have:

local information = {
			["SkinR"] = char.Head.Color.R;
			["SkinG"] = char.Head.Color;	
			["SkinB"] = char.Head.Color;
		}


if info.SkinR then	
				
		
print("skin color found")	
				
local color1,color2,color3 = info.SkinR,info.SkinG,info.SkinB
local color = Color3.new(color1,color2,color3)
				print(info.SkinR)
				print(color)
		
				
		char.Head.Color = color

		char.UpperTorso.Color = color

		char.LowerTorso.Color = color

		char.RightLowerArm.Color = color

		char.LeftLowerArm.Color = color

		char.RightUpperArm.Color = color

		char.LeftUpperArm.Color = color

		char.RightLowerLeg.Color = color

		char.LeftLowerLeg.Color = color

		char.RightUpperLeg.Color = color

		char.LeftUpperLeg.Color = color

		char.RightFoot.Color = color

		char.LeftFoot.Color = color

		char.RightHand.Color = color

		char.LeftHand.Color = color

3 comments

1

use character:GetChildren() and an in pairs loop next time. And at least attempt to do some datastore stuff before asking a question.

0

thats not helping me

0

Would a color3 variable help? data storing that might work :)

1 answer

You are doing

local information = {
            ["SkinR"] = char.Head.Color.R;
            ["SkinG"] = char.Head.Color;    
            ["SkinB"] = char.Head.Color;
        }

You are forgetting to index both G and B to get their colours, which means that you are attempting to instantiate a Color3 with (float, color3, color3) when in reality it takes (float, float, float), to fix this simply change it to

local information = {
            ["SkinR"] = char.Head.Color.R;
            ["SkinG"] = char.Head.Color.G;    
            ["SkinB"] = char.Head.Color.B;
        }

And it should work

This discussion is preserved as it was. New answers, comments, and votes are closed.