here is what the error says Cannot store int in data store. Data stores can only accept valid UTF-8 characters
local module = {}
local DataStore = game:GetService("DataStoreService"):GetDataStore("***********")
game.Players.PlayerAdded:Connect(function(plr)
local Folder = Instance.new("Folder") Folder.Name = "Person" Folder.Parent = plr
local Color = Instance.new("BrickColorValue") Color.Name = "Color" Color.Value = BrickColor.new("Pastel brown") Color.Parent = Folder
local SavedColor = DataStore:GetAsync(plr.userId .. "-Color") if SavedColor ~= nil then Color.Value = SavedColor end
end)
game.Players.PlayerRemoving:connect(function(plr) local id = plr.userId local ColValue = plr.Person.Color.Value DataStore:SetAsync(id.."-Color", ColValue)
end)
return module

4 comments
Put your code in code blocks and I can try and help :)
how do i put them in code blocks
there i did it
You did it on the first line next time what you do is place your question and info first then press the blue lua button. That will make a bunch of ~ inside of those paste your code and then just save it that will format it via codeblocks.