Value of type boolean cannot be converted to a number

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!
    The line this refers too is not a Boolean.

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have and thought I found one with the exact problem. But the topic is closed and the solution was not published on it. So I am asking for a solution to be posted. Here is the function:

local function getMoneyDataFor(player)
	local success, result = pcall(function()
		return moneyDataStore:GetAsync(player.UserId)
	end)
	if success then
		if not result then -- this means that the result is nil. never played this game before
			result = 500 -- this gives the new player something to start with or else just put 0
		end
		return success
	end
	warn("Failed to get data for player: ",player.UserId, result)
	return 0	
end

This is my 1st time getting to ask something just by luck. I tried to reply to that topic which gave me the create a new topic link. Which I have had the hardest time finding on this site. And I have been a reading member for a while now. Where is the Create Topic Button when your reading along or do i have to reply to something to get to the button below. I hope I put enough information above about my issue. Since I do not see where the Boolean it is asking about is.

Think i may have seen something after I posted this. I bet i was supposed to return result not success. But because i have already saved the information once. I cannot figure out how to dump that info so it acts as if I am a new player. To find out if my theory is true.
Can anyone tell me if that was the answer to my problem the wrong thing returned?
or know how to dump the save so I can start a fresh one?

This should be return result.


Just do moneyDataStore:RemoveAsync(your_userid)

2 Likes

After doing the RemoveAsync you suggested. I changed it too return result and that gave me the 500 Gold I was looking for. Thanks for the answer on the RemoveAsync.