Datastore script error

Why my script isn’t working? I was trying to figure it out for hours!!! Please help.

You should retrieve and set the data through a pcall() event, so that if the script decides to throw a tantrum and show an error in your face, it will still save your data.

You’d do something like this:

local success, result = pcall(function()
    -- // Retrieve or save the data
end)

if success then
   -- // Check if the result is true, then continue
else:
   return warn(tostring(result)) -- // Print the error
end
1 Like

The font tells me this is a joke but

Pcall and the returned value will be a table, so get the first indexed item

Because you’re saving the data wrong. You’re trying to get it with Players.UserId…“-data”, and you’re saving it with just a player.UserId. so change the SetAsync to player.UserId…“-data”

1 Like

And oh my god please use a normal font :sob: