Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Getting "Request Rejected" on GetAsync()?

I am a bit new to datastores, and on a recent project no matter what I do I get a "request rejected" output where it says playerData:SetAsync()

It was working fine before until recently, not sure what happened. Anyone have any clue? It would be greatly appreciated!

	local playerData = game:GetService("DataStoreService"):GetDataStore("Players", player.userId)
	if(playerData:GetAsync("Data") == nil) then
		
		local success, message = pcall(function()
		
		playerData:SetAsync("Data", {Credits=0,
			Cases={},
			Guns={
				Shotgun={"Default"},
				LMG={"Default"},
				SMG={"Default"},
				Rifle={"Default"}
				},
			Characters={
				Runner={},
				Tank={},
				Medic={},
				Hunter={},
				Monster={}
				},
			Hunter={Rank=1, XP=0, MaxXP=437, Gun="Default", Character="Default"},
			Medic={Rank=1, XP=0, MaxXP=437, Gun="Default", Character="Default"},
			Runner={Rank=1, XP=0, MaxXP=437, Gun="Default", Character="Default"},
			Tank={Rank=1, XP=0, MaxXP=437, Gun="Default", Character="Default"},
			Monster={Rank=1, XP=0, MaxXP=437, Character="Default"}
		})

		end)
		
		if not success then
    		print("An error occurred: " .. message)
		end
		
	end

Edit: I am going to believe that this is a roblox side bug if no one can actually give me an answer to the problem.

4 comments

0

Are you getting the error in online servers? As well, you might want to swap "Players" and player.userId: the scope of the data store is the second argument.

1

Players is suppose to be the key, while the user id is the scope. So i can insert their user id to get the data on the player. Also, this is on servers on studio. Not play solo, I would double check on actual servers but Roblox currently has a massive bug where you can set up universes anymore. So i cant even test the game on roblox right now

1

That makes sense. Actually pretty clever. I'll steal that. I'm still looking into the bug here, but I can't find out anything so far.

0

Hey Adark, someone on RBXDev was able to help me out. Apparently the only way to currently get it working on studio is if i open it directly from roblox, which wasnt the case before. My code was fine. Thanks for helping though!

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.