Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can is save skin color with Datastore?

Asked by 4 years ago

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
1
use character:GetChildren() and an in pairs loop next time. And at least attempt to do some datastore stuff before asking a question. Dovydas1118 1495 — 4y
0
thats not helping me valledestroy 54 — 4y
0
Would a color3 variable help? data storing that might work :) archerdancom -3 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

Ad

Answer this question