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)
Not quite sure how I'd comment on your post...
local DataStore = game:GetService("DataStoreService"):GetDataStore("CustomStore") game.Players.PlayerAdded:connect(function(Player) local CS = Player.PlayerGui:WaitForChild('ScreenGui').CustomControls.ControlScript local stats = { CS:WaitForChild('HairValue').Value, CS:WaitForChild('HairColor').Value, CS:WaitForChild('PantsValue').Value, CS:WaitForChild('ShirtValue').Value } local Key = "Player-" .. Player.UserId -- This was really all I changed since userId is deprecated. local SavedValues = DataStore:GetAsync(Key) if SavedValues then SavedValues = stats else local ValuesToSave = stats SavedValues = DataStore:SetAsync(Key, ValuesToSave) end end)