Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Change all of the players' GUI text at once?

Asked by
Foboh 5
9 years ago

I'm making a message banner that appears at the top of the screen. This message gets updated using http service so I can send live alerts to all players (like when the the game will shut down for an update). This is my script so far, it is placed in starterGui which means this script will be placed in every single player.


while true do wait(15) local http = game.HttpService local url = "http://thingsfromfoboh.tk/ImportantMessage.txt" local message = http:GetAsync(url, false) script.Parent.Text = message end

The problem with this script is that it must request this information for every single player in the game. I plan to use a lot of http service in my game but there is a 500 http requests per minute limit and it would be more efficient if the game only requests once and then changes all of the player's GUI text.

I realize that I didn't need to throw in all of that http nonsense for my simple question, but I thought this was a cool idea to make this kind of alert system, which is something a lot of constantly updating games should have, so I decided to share.

0
You can always have it update a StringValue and when that value gets changed it updates it for everyone. That way it's only 1 request every time you want to put out a message. lomo0987 250 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
while true do

wait(15)

local http = game.HttpService

local url = "http://thingsfromfoboh.tk/ImportantMessage.txt"
local message = http:GetAsync(url, false)

for k,p in pairs(game.Players:GetPlayers()) do
p.PlayerGui.ScreenGui.TextLabel.Text=message -- This is obviously not the right path, you can edit it

end


0
yes, exactly what I was looking for, Thanks! Foboh 5 — 9y
Ad

Answer this question