Hey so i've been looking on how to make a global message for ex. When the game shutdowns but i couldn't find anything. All i need is atleast a method to spread something globally and that's all.
✓ ANSWER ACCEPTED
How to make a global message? (A message that spreads over all servers)
1 answer
✓ Accepted answer
If you're going to make a message that can be customized and fire anytime then i might have the answer.
Short answer: Data stores. Longer answer: Create a data store system with a string value that'll replicate onto other servers.
Example:
local dss = game:GetService(DataStoreService)
local messageDS = dss:GetDataStore("msg")
while true do
wait(5) -- update interval
print(messageDS:GetAsync("globalMessage")) -- you can set the key to whatever you like
end
This is just the premise and you can of course remove the while loop and instead port this to a gui but this is just an example.
Now it'll print nil (since we haven't set the value yet) every 5 seconds. Setting it to a value is actually quite easy.
local dss = game:GetService(DataStoreService)
local messageDS = dss:GetDataStore("msg")
function newMessage(text)
messageDS:SetAsync("globalMessage",text)
end
There might be more efficient methods but this is just what i have.
And also make sure you've enabled API services in your game.
This discussion is preserved as it was. New answers, comments, and votes are closed.
