-
What do you want to achieve?
saving a color3 in data store -
What is the issue?
it saves a color value WAY OFF what is specified (beyond 256, 256, 256) -
What solutions have you tried so far?
Trial and error really, changing order they are saved in on the table and changing variable names
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("AvatarData")
local RunService = game:GetService("RunService")
local Data = {
Face = 0;
Shirt = 0;
Pants = 0;
Hat = 0;
Torso = {5, 105, 174};
Arms = {245, 206, 44};
Head = {245, 206, 44};
Legs = {165, 190, 69}
}
local playersavetable = {};
local function loadStarterData(Player)
local CharData = Instance.new("Folder")
CharData.Name = "AvatarConf"
CharData.Parent = Player
for statname, statvalue in pairs(Data) do
if type(statvalue) == 'number' then
local intvalue = Instance.new("IntValue")
intvalue.Name = statname
intvalue.Value = statvalue
intvalue.Parent = CharData
else
local colorvalue = Instance.new("Color3Value")
colorvalue.Name = statname
colorvalue.Value = Color3.new(statvalue[1],statvalue[2],statvalue[3])
colorvalue.Parent = CharData
end
end
end
The torso saves as “{1275, 26775, 44370}” for example but in game (on the avatar) it shows as orange while everything else shows as blue.
If you are wondering how I am loading the avatar…
game.Players.CharacterAutoLoads = false
local function onPlayerAdded(player)
local humanoidDescription = Instance.new("HumanoidDescription")
wait(5)
humanoidDescription.HatAccessory = player.AvatarConf.Hat.Value
humanoidDescription.Face = player.AvatarConf.Face.Value
humanoidDescription.GraphicTShirt = player.AvatarConf.Shirt.Value
humanoidDescription.LeftLegColor = player.AvatarConf.Legs.Value
humanoidDescription.RightLegColor = player.AvatarConf.Legs.Value
humanoidDescription.TorsoColor = player.AvatarConf.Torso.Value
humanoidDescription.RightArmColor = player.AvatarConf.Arms.Value
humanoidDescription.LeftArmColor = player.AvatarConf.Arms.Value
humanoidDescription.HeadColor = player.AvatarConf.Head.Value
player:LoadCharacterWithHumanoidDescription(humanoidDescription)
end
game.Players.PlayerAdded:Connect(onPlayerAdded)
(I have a “wait()” in it so it can wait for the data to load/generate)
EDIT: hats, shirts and faces load just fine with these scripts