DailyReward System Having Too Many DataStore Requests

Hi, hope this is in the right category. So, I’m looking for something similar to DataStore2 or ProfileService that uses the same functions as the DataStoreService (Ex. :SetAsync(), :GetAsync(), etc.), but still does not have queue limitations and things like that. If anyone knows of anything like this that I could use, I would appreciate it if you could share it with me. Thanks!

There Is No Real Way To Remove These Queue Limitations Since Roblox Has To Make Them To Prevent Their Datastores Servers From Getting Overloaded.

2 Likes

Right, but I’m looking for a module like the DataStoreService that doesn’t have those limitations.

@Acu1000 (Sorry for @, hope you don’t mind)

As I said, you cannot avoid these limitations. All DataStore modules use DataStoreService (there’s no other way to save data). Just learn how to fit in the limits and you’ll be fine.

It’s saying that I have too many DataStore requests. Do you know of any way around this? Could I make some sort of custom queue?

It’s saying that I have too many DataStore requests. Do you know of any way around this? Could I make some sort of custom queue?

Edit: I think this message duplicated, don’t know why.

Just make sure you don’t make as many datastore requests. You should only save data in these situations:
-Player leaves game
-Server is shut down (use game:BindToShutdown())
-Optionally autosave every 30-60 seconds

If you’re still having trouble, you can always use a datastore module such as ProfileService. You can find one in Community Resources category/

This is the code that’s bringing up the error:

local ds = dss:GetDataStore("DailyRewardStorage")

script.Parent.MouseButton1Click:Connect(function()
	local plr = script.Parent.Parent.Parent.Parent
	local e = ds:GetAsync(plr.UserId)
	if e ~= nil then
		if ((os.time() - e) / 3600) > 24 then
			local amount = math.ceil(math.random(5,50))
			if plr:FindFirstChild("Stats") then
				plr:FindFirstChild("Stats").Gold.Value = plr:FindFirstChild("Stats").Gold.Value + amount
			end
			local currency = "coins"
			local reward = amount.." "..currency.."."
			script.Parent.Parent.Title.Comeback.Text = "You have received your reward of "..reward
			wait(3)
			script.Parent.Parent.Title.Comeback.Text = "Come back in "..math.ceil(24 - ((os.time() - e) / 3600)).." hours to get your next reward!"
		else
			script.Parent.Parent.Title.Comeback.Text = "Your reward has already been claimed."
			wait(3)
			script.Parent.Parent.Title.Comeback.Text = "Come back in "..math.ceil(24 - ((os.time() - e) / 3600)).." hours to get your next reward!"
		end
	else
		local amount = math.ceil(math.random(5,50))
		if plr:FindFirstChild("Stats") then
			plr:FindFirstChild("Stats").Gold.Value = plr:FindFirstChild("Stats").Gold.Value + amount
		end
		local currency = "coins"
		local reward = amount.." "..currency.."."
		script.Parent.Parent.Title.Comeback.Text = "You have received your reward of "..reward
		wait(3)
		ds:SetAsync(plr.UserId, os.time())
		local e = ds:GetAsync(plr.UserId)
		script.Parent.Parent.Title.Comeback.Text = "Come back in "..math.ceil(24 - ((os.time() - e) / 3600)).." hours to get your next reward!"
	end
	ds:SetAsync(plr.UserId, os.time())
end)

Any ideas on how I could fix. Btw the error is for too many DataStore requests.
Thanks!

You are using SetAsync twice try to avoid the one SetAsync in else and you should be fine.

1 Like

How could I avoid it? I need it there.

You call GetAsync and SetAsync every time the button is clicked. As I said before, you should only call GetAsync when player joins and SetAsync when they leave or server gets shut down, or you can also add an autosave every 30-60 seconds.

Also use pcall for these functions since they can ocassionally error.

2 Likes

Do you really need to save this information each time player clicks?

This won’t help since his code basically allows players to spam datastore requests as much as they want.

Yes you got a point this is just bad.

Yes, but what could I do as a workaround. I can think of no better alternative that what I have right now. I need the information for daily rewards.

Edit: Sorry if my code is bad, I’m fairly new to scripting.

How would you suggest that I do a DailyReward system without DataStores? (I don’t want to do RemoteEvents because they could easily be manipulated from the client)

You have a big misunderstanding how Remotes work… well yeah Exploiter can invoke/fire server but you can just have connection Server to client and just send the information to Client and when player is eligible to get reward player will Invoke/Fire the server and gets reward but you will save the time when the player claim it and if exploiter wants to false invoke/fire server you will just check if the time now is 24 hours since player claimed the reward… btw AlvinBlox made great tutorial on it please use youtube/devforum when you trying to do something that you dont fully understand.

AlvinBlox video here:

If this help you consider mark this as solution because it can be helpful for other developers too ;).

1 Like