Datastore not saving, but not erroring. ( Yielding? )

If you follow the code on the right, you can see the corresponding prints to the left in the output.
For some reason, the code past the pcall does not execute. You can see that ‘Success’ never prints. It’s a boolean because thats what the pcall returns.

Is SetAsync() just yielding? If so, is it yielding so long the data is never saved?

There are no errors at all.

1 Like

Success is the successful state and error is the negative state. Try this:

if Success then

if Error then

You’re actually completely wrong, just look at the lua docs:

Don’t spread false information if you don’t know what you’re talking about

1 Like

If I am wrong, then why does my method work every single time I implement it. Actually, I am partly right. Take a look at this:

Calls the function func with the given arguments in protected mode. This means that any error inside func is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message.

Therefore, my method still works because pcalls can take in two values. Which is in the case of the
original poster, he used my method of having local success, Error = pcall(function() end).

P.S. if you are trying to be a fact checker, don’t do it here, this still doesn’t solve the original problem and it just creates a side tangent unrelated to the post. If you do find false stuff, why not DM me?

looks like you’re trying to save in studio, you need to make a BindToClose connection which saves everyone in the server’s stats else the save function can yield as the server is considered closed after the test session is stopped which disables any script from running

How does this actually prove your original point? When doing your code on an any datatype, it will always run the code unless it is a boolean and false or nil,

type any = ANYTYPE
local Any: any | string -- string is unnecessary here, but used as an example
if (any) then
    -- this will always return true
    -- This code cannot be reached, even the your linter (if you're using VsC, will tell you that the above code will always return true)

They say “StatusCode” as in true or false, they don’t actually return a 200, a 501 etc.

1 Like