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

I want to make save data but I dont undarstand how its work so I get error,how to fix that?

Asked by
kiref81 -24
1 year ago
local DSS = game:GetService("DataStoreService")

local PlayerColor = DSS:GetDataStore("Color")

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local Folder = Instance.new("Folder")
        Folder.Name = "Data"
        Folder.Parent = Player
        local ColorValue = Instance.new("IntValue")
        ColorValue.Name = "ColorSD"
        ColorValue.Parent = Folder
        ColorValue.Value = PlayerColor:GetAsync(Player.userId) or 0

        game.Players.PlayerRemoving:connect(function(Player)
            PlayerColor:SetAsync(Player.userId, ColorValue.Value)
        end)
        while true do
            wait(10)
            PlayerColor:SetAsync(Player.userId, ColorValue.Value)
        end
    end)
end)

error: DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 494134389

Answer this question