Third party purchase, I did developer products previously but they cause problems with the os.time functions, so I’m doing table now
with the loop you did this wont work, because Platinum is v
So do i just do it without a loop?
yeah you dont really need a loop…
You don’t manually put in tables into your code with player id’s in it
What’s the problem with it, they DM me on discord and purchase a membership type, and I just add their ID and type that’s it
(Robux ofcourse)
Because that insane. You can make a shop and sell a gamepass or something and do the same thing.
That’s like everytime you went to gmail.com there was a person who manually typed in code to bring up your email.
There are more ways to achieve what you want you can just do like others said
yourtable[player.UserId].Expiration
but sometimes you need for loop because for example when you dont know the index (player.UserId) in this situation.
Gamepass is forever, developer products and os.time functions caused real time stats problems, I been using this method with gun spawners in some of my games too.
I don’t know what you mean “cause problems”. Gamepasses and Developer Products only function is to sell something for robux. I’m not sure what “developer products and os.time function cause problems”(what does one have to do with the other)
A proper way to do this, is to create a datastore for each player and save the data you want to said datastore, then retrieve said data when they join a game.
Okay I will explain it.
local myArray {"Hello", "Hi", "Hey"}
--// if we print the index now it will be number
for index, value in pairs(myArray) do
print(index) --//Expected output 1,2,3
end
local myDictionary = {
["Hello"] = {"Hi"},
}
for index, value in pairs(myDictionary) do
print(index) --// expected output Hello
end
Look, I had membership system using devleoper products and os.time functions, if they buy it they had it for 1 month, but it caused so many problems that normal stats that didn’t even mean to real time like the membership values did, I already made a topic about this and nobody had a solution, so i decided to go back to tables since this is the easiest way for me to keep track of things
It appears you are unaware what a DatasStore, a DataStore is Roblox’s database that they let Roblox developers use. It is vital to know because it is literally how you save any player data (I don’t know how you got this far without using it) Just because you are not using something correctly doesn’t mean it’s broken
Here is a decent tutorial on it by AlvinBlox, DataStores are considered somewhat advanced and they make take some time to learn.
everything worked fine, datastore too, the problem was that other stats kept on real timing, like I have minutes stats, and if the player leaves the stats still go +1 even if the player is not in-game,the membership system worked fine but os.time functions bugged it
This worked best for me, thank you.
Hey @elonrocket you probably don’t understand the whole problem, @ApeRuss is trying to save the os.time() from developer product so when the stored os.time() reach certain time it will remove the membership I would assume OP wants easy way to give people certain membership. (Easy way to access the information)
That’s because os.time() returns Unix epoch, which keeps on moving no matter what. If you didn’t implement a system where you see at what time they join and what time they leave then do subtraction. Yes it will “bug” as you say (even though it’s not bugging, you just aren’t using it properly)
@caviarbro I’m aware there’s are multiple problems here.
As i said, the whole membership system worked fine. but it kept moving on even if the servers are offline with the other stats that are not meant to go up
I just explained to you why in the previous post
The code can look like
local joinTime = {}
local leaveTime = {}
game.Players.PlayerAdded:Connect(function(player)
joinTime[player] = os.time()
end)
game.Players.PlayerRemoving:Connect(function(player)
leaveTime[player] = os.time() -- you don't really need this line, it's for demo
playTimeFromCurrentSession = leaveTime[player] - joinTime[player]
-- you can then add that to a "TotalPlayTime" value and datastore it
end)
The saving is not the problem, only problem is that other stats go with it