Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to have text label update for all Player's Gui??

How can I update every one's player gui instead of only updating for 1 player's gui??

plr.PlayerGui.Warnui.TextLabel.Text = "U are cool"

1 answer

✓ Accepted answer

It's ideal that you use FireAllClients() with a RemoteEvent.

Put a RemoteEvent in ReplicatedStorage, be sure to name it whatever you want and edit the script accordingly.

ServerScript - Be sure to put this in ServerScriptService

local replicatedStorage = game:GetService('ReplicatedStorage')

local Remote = replicatedStorage:WaitForChild('RemoteEvent') -- change to your remote name

Remote:FireAllClients('U are cool')

LocalScript - Be sure to put this in StarterPlayerScripts

local replicatedStorage = game:GetService('ReplicatedStorage')
local Players = game:GetService('Players')
local Player = Players.LocalPlayer

local Remote = replicatedStorage:WaitForChild('RemoteEvent') -- change to your remote name x2

Remote.OnClientEvent:Connect(function(Message)
	local warnUI = Player.PlayerGui:FindFirstChild('Warnui')
	if warnUI then
		warnUI.TextLabel.Text = Message
	end -- check for UI
end) -- on client event

7 comments

1

Or you can iterate all players using Players:GetPlayers() and go to Plauer.PlayerGui to enable

0

local Players = game:GetService("Players")

0

for _, Player in ipairs(Players:GetPlayers()) do

0

Player.PlayerGui:WaitForChild("Warnui").TextLabel.Text = "U are cool"

0

end

0

Thank you for your help!!

0

T3, doing that would not be ideal due to if any UI is made by the client, and only accessible via client, using FireAllClients() allows the code to see any potential UI.

This discussion is preserved as it was. New answers, comments, and votes are closed.