Hey. I’m making a donation game and I want to know how to start making a live donation board. In games like PLS DONATE, the board has to update every .1 seconds, and I don’t think using a datastore would be good for that. Does anyone have any ideas/tutorials? Thanks.
Idk how to make one, but I think it involves HTTPS service you should be able to find tutorials on youtube
Use data store services and save every player donation
could messagingService work?
asdkljfhaslkdjfjlkasdflkjdaslkjf
The replies here are terrible options. Don’t use a data store.
You have 2 options:
1. Use MessagingService to share messages across servers
MessagingService allows you to connect servers by subscribing to a topic, and publishing when needed. You won’t need to update every 1/10 of a second (which isn’t the greatest idea, refreshing that fast can overload servers.) and can simply update when receiving a message.
Example:
A script inside ServerScriptService
-- Services
local MessagingService = game:GetService("MessagingService")
-- App
local Topic = "Donations"
-- Our topic is where we'll receive messages and post to.
-- Receiving
local Connection = MessagingService:SubscribeAsync(Topic, function(Message)
-- Message is a table. It contains 2 variables called Data, which is our message data and Sent, which is a timestamp of when the message was sent.
print("Received donation, message:", Message.Data)
-- This is just an example of handling data. Code it to handle how you want it to.
end)
-- Sending
MessagingService:PublishAsync(Topic, "Har just donated 10 billion robux!")
-- Sending is just that easy. You'll obviously change it to your liking though.
2. Code your own web API
Now this is a more advanced option, which I’d only recommend if you have an understanding of how an API works. The basics are you receive GET and POST requests.
A get request is data that is going to be sent back to the client, like how web pages work. The client sends a request to get the web page, and the server sends the html file back!
A post request is data that the server receives from a client. These requests can be processed in a variety of ways, but Roblox sends post requests as JSON. So you’ll process these requests as JSON.
I won’t give you any examples, as there’s a variety of programming languages you can code APIs in.
Ones I’ve coded always used Node.js, which has the dependency Express you can use.
To send post requests, use HttpService in Roblox.
Your web API will receive post requests, and add them to an array. This array will only contain the 10 most recent requests, and remove any that are older than the recent.
When it’ll receive a get request, it’ll send back that array to the client. Roblox can then process this using JSONDecode, and send requests in JSONEncode.
Your roblox server will get data from the server every 15 seconds from the web API and refresh a list.
Advantages and Disadvantages
MessagingService can’t send any older messages to new servers, which a web API can.
MessagingService will be faster.
It is also more secure, yet could be messed with via backdoors. Your web API could be DDOSed if you reveal it to the public.
Good luck.
Thanks! I’ll be using MessagingService since I don’t have any coding experience besides LUAU. Is there a refresh rate that you would recommend?
There’s no refresh rate for MessagingService. You just receive the message and process it as an event.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.