Hey all,
I'm getting the error "Argument 2 missing or nil" when trying to SetAsync() a datastore, I'm not sure why this is happening since all the arguments print out, so it must be in the way I'm trying to store these values.
The setAsync() Function is as follows:
local function setAsync(player, gamepass, name)
print(player)
print(gamepass)
print(name)
local success, err = pcall(function()
gamepassDataStore:SetAsync(player.UserId.."-"..gamepass, game.Players[player.Name].data.name.Value)
end)
if success then
print(success)
else
print(err)
end
end
All of the arguments print as shown below: Stedaa Dominus IsDominusHatEnabled This is the way the function is called:
setAsync(player, "Dominus", "IsDominusHatEnabled")
An example of what I'm trying to achieve would be something like this specific to the gamepass:
gamepassDataStore:SetAsync(player.UserId.."-Dominus", game.Players[player.Name].data.IsDominusHatEnabled.Value)
Thank you for your much appreciated help!

2 comments
The "argument 2 missing or nil" is an error with your gamepassDataStore:SetAsync. Try printing game.Players[player.Name].data.name.Value and see if it's nil
It returns nil, however I know the BoolValue does exist so I'm not sure why that is happening, any ideas?