How to make my donation board automatically update?

I’m new to scripting.
I’ve made a workable donation board, but something I noticed is that, in-game, when I buy a DevProduct, it doesn’t appear in the leaderboard, though in Studio it appears. Is there any way of making it update automatically?

Also would like some help according to the global message; when someone buys a DevProduct, some effects appear, but I’d like a message to appear in every server (global chat) with a text saying ‘(player) donated (x) Robux, Thank you for supporting the game!’

Make a loop, if you are saving the Data, you would need to update it in a certain period of time, a good time would be between 20 - 60 seconds, where you would want the page to refresh, if you do it earlier, you will likely run into issues with the DataStore dropping requests.

Depending on what you mean by global Message, If you mean to all Servers, This is where MessagingService will become your best friend, Subscribe the Servers with the Message you want to send Using SubscribeAsync, and when the Event occurs, use PublishAsync, and send the corresponding data. If you mean just within the Server, you can have a RemoteEvent Fire to All Clients when something happens

1 Like

That’s new for me, I watched some videos about MessagingService but I cannot see any useful help. Could you guide me with the beginning (suscribing the servers with the message I want using suscribeAsync)

I’ve already done that, but at first the leaderboard wouldn’t refresh, I rejoined the game and it refreshed… Pretty strange but now it works, thanks!

local msgSvc = game:GetService("MessagingService")

-- Subscribing

msgSvc:SubscribeAsync("myTopic", function() -- create a topic, and the corresponding data to fire
    print("This will fire to all Servers!") -- what you want the function to fire
-- Only Servers that are Subscribed can see this
-- so make sure you have it for all the Servers
-- Topics can only handle uo to 1KB of Data, which
-- is roughly 1,000 bytes, or 1000 characters, if you
-- speak a different language and use different keys,
-- on a keyboard, it may be more than 1 byte because the
-- unicode point for the character is above the first 128.

-- Firing:

-- use the correct topic, otherwise it wont fire the correct data
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.