Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do games expire twitter code?

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?

2 comments

0

They probably just remove the code script.

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.

3 answers

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

3 comments

0

Using os.time() is risky because any user can easily change their operating system's time to whatever they like

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

0

You might be thinking about os.date(). os.date can be both local and UTC time whereas os.time() is just UTC

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.

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

1 comment

0

this isn't true. there are many methods of doing this

This discussion is preserved as it was. New answers, comments, and votes are closed.