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)
everyone I fixed it myself! :) also here is the local script that I use that's inside the PlayerGui
local s = script.Parent.Parent.stats while wait(0.09) do if s.exp.Value >= s.level.Value * 100 then s.exp.Value = 0 s.level.Value = s.level.Value + 1 end end
also, I'm looking for a more reliable script!