It prints Cannot Store Array In Data Store on line 23..This is one of my first times using Data Stores so I'm a little confused as to what to do.. please help
local DataStore = game:GetService("DataStoreService"):GetDataStore("CustomStore")
game.Players.PlayerAdded:connect(function(Player)
local HairValue = Player.PlayerGui:WaitForChild("ScreenGui").CustomControls.ControlScript:WaitForChild("HairValue").Value
local HairColorValue = Player.PlayerGui:WaitForChild("ScreenGui").CustomControls.ControlScript:WaitForChild("HairColorValue").Value
local PantsValue = Player.PlayerGui:WaitForChild("ScreenGui").CustomControls.ControlScript:WaitForChild("PantsValue").Value
local ShirtValue = Player.PlayerGui:WaitForChild("ScreenGui").CustomControls.ControlScript:WaitForChild("ShirtValue").Value
local Key = "Player-" .. Player.userId
local SavedValues = DataStore:GetAsync(Key)
if SavedValues then
HairValue = SavedValues[1]
HairColorValue = SavedValues[2]
PantsValue = SavedValues[3]
ShirtValue = SavedValues[4]
else
local ValuesToSave = {HairValue, HairColorValue, PantsValue, ShirtValue}
SavedValues = DataStore:SetAsync(Key, ValuesToSave)
end
end)

2 comments
BrickColor Values (userdata) cannot be stored in a DataStore.
It doesnt work when I get rid of that either.