Argument 1 missing or nil

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Make it so the script functions properly
  2. What is the issue? Include screenshots / videos if possible!
    image
    Line that keeps giving the error:
Information = HttpService:JSONDecode(Information.Data)

The DatastoreUpdate Function:

function _G:DatastoreUpdate(FuncInformation,Update)
	local Player = FuncInformation.Player
	local Key = Player.UserId
		local Information = ArrestDatastore:GetAsync(Key)
		local Sentence = 0
		local Threshold = 15
		if Information == nil then
			Information = {
				Sentence = 0
			}
		ArrestDatastore:SetAsync(Key,HttpService:JSONEncode(Information))
		end
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Uhhh, I added in Information.Data so it gets rid of the String error that kept giving me an error.

Since JSONDecode will provide an empty table with a nil request, and will error when the input is not a valid JSON object, that must mean Information.Data isn’t a valid JSON object. Make sure that Information.Data is actually what you seem to want it to be.

I don’t know, this is what the function and the script is:

1 Like

You are able to save tables in a datastore anyway, so encoding it into JSON doesn’t seem necessary.

1 Like

So am I just able to remove the line giving the error to cancel it out?

in my knowledge you should lowercase it

like this

Information = HttpService:JSONDecode(Information.data)

If I lowercase to data, it still gives me the same outcome of Argument 1 missing or nil.

Also this is line 95:

game.Players.PlayerAdded:Connect(function(Player)
	local PushTable = {
	Player = Player
	}
	_G:DatastoreUpdate(PushTable) -- line 95
end)

require(script.Parent):FlushWebhooks()

well your setting it with the user’s ID

so we have to get it from the user’s ID

Information = HttpService:JSONDecode(plr.UserId, Information.data)

To Ferb: That’s not how JSONDecode works. Check the docs for more information:
https://developer.roblox.com/en-us/api-reference/function/HttpService/JSONEncode

@roblox_user_54556995 It does error when you provide it with nil, not return an empty table. It gives you an empty table… if you give it an empty table.
image

2 Likes