i need some help with a level up system in my rpg datastore error: "03:24:51.587 - DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 96434321"
local ds = game:GetService("DataStoreService")
local leveldata = ds:GetDataStore("level")
local expdata = ds:GetDataStore("exp")
local golddata = ds:GetDataStore("gold")
game.Players.PlayerAdded:Connect(function(plr)
local stats = Instance.new("Accessory")
stats.Name = "stats"
stats.Parent = plr
local level = Instance.new("IntValue")
level.Name = "level"
level.Parent = stats
level.Value = leveldata:GetAsync(plr.UserId) or 1
local exp = Instance.new("IntValue")
exp.Name = "exp"
exp.Parent = stats
exp.Value = expdata:GetAsync(plr.UserId) or 0
local gold = Instance.new("IntValue")
gold.Name = "gold"
gold.Parent = stats
gold.Value = golddata:GetAsync(plr.UserId) or 0
level.Changed:Connect(function()
leveldata:SetAsync(plr.UserId,level.Value)
end)
exp.Changed:Connect(function()
expdata:SetAsync(plr.UserId,exp.Value)
end)
gold.Changed:Connect(function()
golddata:SetAsync(plr.UserId,gold.Value)
end)
game.Players.PlayerRemoving:Connect(function()
leveldata:SetAsync(plr.UserId,level.Value)
expdata:SetAsync(plr.UserId,exp.Value)
golddata:SetAsync(plr.UserId,gold.Value)
end)
while wait(30) do
leveldata:SetAsync(plr.UserId,level.Value)
expdata:SetAsync(plr.UserId,exp.Value)
golddata:SetAsync(plr.UserId,gold.Value)
end
local function levelup()
while wait(0.09) do
local hum = plr.Character:WaitForChild("Humanoid")
exp.Value = exp.Value - level.Value * 100
level.Value = level.Value + 1
hum.MaxHealth = hum.MaxHealth + 10
hum.Health = hum.MaxHealth
end
end
level.Changed:Connect(function()wait() levelup()end)
exp.Changed:Connect(function()wait() levelup()end)
end)

3 comments
Try putting those stats,levels gold etc into a table then saving the table.
@Andromeda0161 i have no clue how to use tables!
also @andromeda0161 im not trying to save im trying to make the level stat go highter