Hello, I want to make a game with a membership system, that the membership expires after the time is over, but it doesn’t work.
Script:
game.Players.PlayerAdded:Connect(function(player)
local dates = os.date("*t")
local data = adatastore:GetAsync(player.UserId) --adatastore is already declared.
if data.ExpireDay >= dates["day"] and data.ExpireMonth >= dates["month"] and data.ExpireYear >= dates["year"] then
--Script that runs when it is expired
print("Expired")
end)
For some reason it always prints “Expired”, but the Membership is expiring in one month.
I think you mixed them up, it should be dates[“day”] >= data.ExpireDay not the other way around.
if dates["day"] >= data.ExpireDay and dates["month"] >= data.ExpireMonth and dates["year"] >= data.ExpireYear then
--Script that runs when it is expired
print("Expired")
end)