Could someone point me in the right direction for changing text in everybody's screenGui? Notice, Im not asking for code to make the GUI, I just need to know the code that can access everybody's GUI.
COMMUNITY QUESTION
Could somone point me in the right direction for changing text in everybody's screenGui?
2 answers
Try using a 'for' loop to loop through the players.
An example?
for k,Player in pairs(game.Players:GetChildren()) do
Player.PlayerGui.ScreenGui.TextLabel.Text="Hello world!"
end
So this is probably the best method I have ever found, shown to me by a friend. It works perfectly.
So in this example we will have a string value called "Notice" in game.Lighting (It doesn't actually matter where it is located or named as long as you consistently refer to it the same way always)
This will be the script that shows whatever text you want to say
local notice = game.Lighting.Notice
notice.Value = "Test"
wait(1)
notice.Value = ""
wait(3)
-- A little countdown example
for i = 30, 0, -1 do
notice.Value = "Countdown - "..i
wait(1)
end
This script will be inside the TextLabel (or whatever you are using to hold the text)
local notice = game.Lighting.Notice
Update = function()
script.Parent.Text = notice.Value
--If you had a background you wanted to hide whenever the value was empty you could even do this:
if notice.Value == "" then
script.Parent.Parent.Background.Visible = false
end
end
Update() --So that when they respawn it will show up again
notice.Changed:connect(function(Update)
And there you go! You now have an auto-updating notification GUI that shows on all player screens.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Edited
Didnt work, No output in the developer menu or regular output window for studio.