How to make a value changes every 1 hour to every server

i have a string value that is named “Current Trend” and i want to make this value to change every 1 hour to all servers and all have the same changed value.

for example this table

Trendy games = {

 "Parkour Game";
 "FPS Game";
 "Tycoon Game";
-- etc
}

every 1 hour the system randomly select one string,
the closest example i have is a game in roblox named Bitcoin miner that has the “algorithms” (which is just a string value) change every hour, as far as i can remember,

how can i make this system?

any help will be appreciated

1 Like

Hello! I think you should use MessagingService
I will give an example a little bit later

3 Likes

take your time, i will start looking into messaging service in a bit

2 Likes

So, basically you just write

game:GetService(“MessagingService”):PublishAsync(“listen,servers!”, string)

Recommended that you dont send a table because the maximum you can send is just 1kB per request, and tables are taking a lot of space.

The code to send a message

3 Likes

I think using an external API to get UTC time and then checking for hour updates independently on each server would be best.

3 Likes

i can send the string pretty sure thats 1Kb, but the issue is how can i make it so its every hour

2 Likes

how can i do that exactly?

char limit

2 Likes

just use while loop, the best way
1 hour = 3600 seconds

btw to get the information use :SubscribeAsync()

to not get the information use :Disconnect()

DISCONNECT IS NOT THE MESSAGINGSERVICE METHOD

2 Likes

But what if Server A started at UTC 0:00 and Server B started at UTC 0:30, wouldn’t this make Server be 30 minutes before of Server A?

1 Like

Also yielding that much is very bad for efficiency and optimizations.

2 Likes

im not sure but i think getting the time from the API server would be the same to all servers because they are recieveing the same clock time

1 Like

cant we just send the time to the server B and then we check the difference between the server B time and the server A’s sent time then we just wait the difference time (wait(difference))

1 Like

But all servers have the same code, you will need to make a system that needs to ask a request to other servers or get time if no other exists and then reply receiving system, trust me using an third-party HTTP get API would be easy and most games do this or you can also setup own HTTP time server.

then i don’t know how to do that

but wont the first request make both servers synchronized after the requests
AND I DONT CARE ABOUT NEW SERVERS
they will still get synchronized

but the servers will still send info to the other servers and vice versa tho…
the only way to do this is HTTP requests i guess

You can use HttpService like MessegingService

let me simplify, i want to make a system that sends to all servers a string every 1 hour, think like an item shop system that rotates every 24 hours but instead every 1 hour and sends a string to all servers.

The best choice for you is HttpService, but if you are testing a thing just for yourself and not planning to do anything big, use MessagingService

best bet is if you could go around sending messages and just using a pseudo-random generator with a set seed and use os.time() to check if an hour has passed from a set point

1 Like