Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do games expire twitter code?

Asked by 5 years ago

For example, in Miner's Haven he releases codes, then a couple days after it's expired, how do you do that?

It's extremely easy to make the scripting behind the code GUI, but how do you make it so it expires? One way I know could be to make an IntValue called 'Expired' and set it to true but what if someone joins in a old server and they use that code? It would still be valid in old servers so it's not the most efficient way of doing it.

How do you make it so it expires for all servers, I'm assuming HttpService?

0
They probably just remove the code script. User#19524 175 — 5y
0
Yeah but did you read what I said? I said how do you make it so it expires on all servers instead of having to shutdown? Plus, removing the code script is silly, because what if you want to have other codes running but some to expire. YabaDabaD0O 505 — 5y

3 answers

Log in to vote
0
Answered by
T1mes 230 Moderation Voter
5 years ago
Edited 5 years ago

You can use DataStores to communicate between servers.

A better way to go about this though is check the table os.time() and validate if the date is past expiration or not.

More info on the table os.time if needed: http://wiki.roblox.com/index.php?title=Global_namespace/Basic_functions#os.time

0
Using os.time() is risky because any user can easily change their operating system's time to whatever they like chomboghai 2044 — 5y
0
Actually, tick() is local based and runs on the clients current time. os.time() is more stable because it basically runs on the servers time YabaDabaD0O 505 — 5y
0
You might be thinking about os.date(). os.date can be both local and UTC time whereas os.time() is just UTC T1mes 230 — 5y
Ad
Log in to vote
0
Answered by
chomboghai 2044 Moderation Voter Community Moderator
5 years ago

There are probably many ways of doing this, but if it were me, I would have a module consisting of all my codes in a table of tables like this:

local codes = {
    {
        code = "FREESTUFF",
        expired = false,
        reward = {
            diamond = 5000,
            money = 2000,
        }
    },
    {
        code = "OMGMONEYZ",
        expired = true,
        reward = {
            money = 5000,
        }
    }
}

return codes

I know a lot of places that have codes only release codes when they push large updates, and this would work well because you can force close all servers after the update is pushed and all your servers would be updated to match the new codes.

Log in to vote
-1
Answered by
SCP774 191
5 years ago

There's no way to do that without HttpService, so I assume you need to use HttpService for this.

0
this isn't true. there are many methods of doing this chomboghai 2044 — 5y

Answer this question