How to make temporary ban?

I was thinking on saving the tick() of ban start, and when player joins compare if the time elapsed in seconds its more than the second ban like, 86K seconds (day)

I am not really experiened with os.time() that’s why :slight_smile:

3 Likes

Sure! You can definitely use tick for time passed checks since tick is equal everywhere including game servers on Roblox.

3 Likes

Thanks, I didn’t knew if tick() would work, due to most of the Programemrs to make this use os.time() which, I mean, it’s more complicated than using tick(), is it more efficient? :thinking:

1 Like

Don’t take my word on this, but I think os.time() is the operating system’s time, which I’ve no idea if Roblox’s servers use linux or whatnot. :man_shrugging:

However, tick is a guarantee at least. And most of us are fairly familiar with tick and it’s being used widely for various functions!

2 Likes

I don’t tick() is equal across servers? Doesn’t it base off of the local timezone, where as os.time is a fixed timezone GMT. I could be wrong, but i’ll recommend using os.time for something like this.

1 Like

According to Roblox’s API:

Tick is also not limited to just Roblox. Many programs and professional games use tick as well. :slight_smile:
Remember, it doesn’t matter what your timezone is if an event happened at a certain time. Because if you convert the time when the event happened to your local timezone then the time passed would be the same as for any other timezone as well. :wink:

1 Like

Don’t use tick() for stuff like temporary bans. tick() returns local time zone, so when called on the server it will return the server’s time zone. Use os.time(), it returns UTC time and will always be the same.

1 Like

You’re misinformed my guy. :slight_smile:
I ran a test now on 2 one-player servers with the server changing a textlabel representing the current tick() in minutes.

2 Likes

That’s because it’s returning the timezone that your computer’s in (because you’re the host). If the server was hosted somewhere else it would return that country’s timezone in relation to the UNIX Epoch. Correct me if I’m wrong.

1 Like

Entirely wrong. This is run on two different Roblox servers with 1 players max in each. And as I said, the server is changing the textlabel based on tick().

1 Like

No, what he’s saying is that your computer and that server you are representing tick() in is run on your local time zone, if that be EST, BST, PST, whatever it is. If another player from a different time zone from your time zone, joins the game, the tick() would be different, because tick() does not revolve around UTC, it is based off your time zone. Os.time is the one that goes based off of UTC, and no matter where you are in the world, UTC will not change, whereas tick changes to the timezone of the player with the server.

1 Like

This is wrong. Yet again read what I said. No offense. :slight_smile:

Quote:

I understand, and I know that textlabel won’t change since the server is changing it. But in relation to the post and the ban time, that will fluctuate based on where the person lives, and where the person who handed out the ban lives.

Assuming the client would attempt to connect to the closest server, if you’re running both clients from the same general location they would both connect to the nearest server, which would return the same value.

No. Due to the fact that AFAIK Roblox’s servers are based in america and is not hosted by any of the players.

Uh, I don’t understand, so do I use tick() or no :laughing:

Tick() is completely fine to use. These fellas seemingly don’t understand what I mean when I state things like these.

Do not use tick(), it returns a “local” time depinding of the time on your computer, therefore the player can bypass the ban. I would recommend using os.time() instead.

(To be fair os.time() works just like tick() but instead of a local time it returns time based on a timezone so I dont think it would be such a problem to use it instead)

This is wrong. How can you state these things without any kind of proof? Yet again my statements are related to the server, not the client. Therefore your computer has no say in what tick() returns.

As I said it returns a local time, the date and time in your computer can be changed. Try changing it and then play and then use other computer just like how you did but with the current time.