Attempt to compare number and boolean?

So I’m working on a membership system but I got a problem with some values over here,

Basically the platinum time datastore is not a boolean value and I have no idea why it says “attempt to compare number and boolean” when i play the game, the only boolvalue there is, is the parent of the platinum time value:

image

Platinum, BooleanValue (I use this because it’s more simple for me to make perks if this is true)
PlatinumTime, IntValue (Membership duration before it expires and sets the Platinum boolvalue to false)

As I said, the “PlatinumTimeDatastore” is the IntValue

For the rest I don’t even know what to say because I’m confused and lost about 300 braincells this hour.

???

I think it means os.time is a number and your GetAsync is a boolean, you are basically checking if a number is less than or equal to a boolean, which is impossible.

1 Like

So what do I do here? because this already has been performed here: How To Make A Membership System

But mine is just customized and it does not work.

In that tutorial, is ‘MembershipInfo’ a number? If it is, then that’s why. Your value is a boolean, not a number.

1 Like

Wait I don’t get it, I don’t even know if it’s a number or a bool in that tutorial, it’s just a datastore

You should call

local PlatinumTime
	local Success,Error = pcall(function()
		PlatinumTime = game:GetService("DataStoreService"):GetDataStore("PlatinumTimeDatastore2_"):GetAsync(Player.UserId)
	end)

Now the variable PlatinumTime is an integer, and you can compare it to os.time() after making sure it’s not nil (which happens in case of an Error in GetAsync):

if PlatinumTime then
    if os.time() <= PlatinumTime then
        --treatments
    end
end
1 Like

I already done this before, it just gives me the same thing.

Ok so I read that tutorial and I think it saves the duration/time of the membership or something, seems like a number. In your script, what exactly are you saving?

1 Like

The time ofcourse “PlatinumTimeDatastore2_”

According to the error you are saving a boolean. Can you check your script again, and check the tutorial too? Or maybe show your full code.

The PlatinumTime value is not a bool value

Can you send your saving to datastore script? the problem might be there.

1 Like

Use sleitnick’s DataStore Editor plugin to see what was being saved to that specific key. It will tell you the data type that was saved. Let us know what the saved data is.

8 Likes

On player joined:

On player leave:

2 Likes

Wait am i dumb, give me a couple minutes, I’ll try to fix it real quick

4 Likes

You see the problem too, nice.

2 Likes

It’s always like that for me, the most simple problems are the hardest to notice for me.

3 Likes

The same problem happened to me once, and it was a headache to fix…

2 Likes

Well it’s all good, we learn from our mistakes

2 Likes

yes way, I didn’t even realize he replied because I didn’t look at it’s name

1 Like