Changing GUI of all players

Hello!

I’m creating a UI for a school, and on this UI I want to create a button that requests a developer. When the player clicks the button it displays a TextLabel on the screens of every player in the server. But It’s not working and it’s not giving an error.

I have the this code:

	script.Parent.Parent.Parent.Tannoy.Visible = false
	script.Parent.Parent.Parent.StaffMenu.Visible = true
	for i,v in pairs(game.Players:GetPlayers()) do
		v.PlayerGui.StaffMenu.TannoyMessage.Message.Text = (v.Name.." Needs a Developer/Server 
                Manager")
        end
end)

This only changes the text on the players screen that sent it. I’ve attempted to google this issue and have had no luck, hopefully the brilliant minds of the Dev Forum will be able to help!

Thanks,
E_Link

5 Likes

I could give just give you fixed code and be done with it, but the result would be that whatever project your working on becomes an incomprehensible mess.

When working with UI’s, as a general rule, any changes to a Players GUI’s should be made by the player themselves, the client, and not the server. To do this you need to use Remote Events and Remote functions, and to use them you need to understand what FilteringEnabled ‘Experimental Mode’ is and how it works. The wiki has plenty of articles on these, I recommend you give them a read and make some practice things with them.
For starters:
http://wiki.roblox.com/index.php?title=Experimental_Mode
Then it’s probably a good idea to go through and understand as many as you can:
http://wiki.roblox.com/index.php?title=Learn_Roblox

In my games, and I think in many other games, I have a RemoteEvent in replicated storage which can be fired by the server with a string as a parameter, that causes a local script on the client to create and display a message with that string. This is the kind of system you should be aiming to make in the end.

8 Likes

BTW, you can use three weird tick symbols (```) before and after your code to format it.

2 Likes

Yes I understand remote functions and ‘Experimental Mode’,

The last time I used a script like this was before the FE -> EX update when it did work. Thanks a lot for the help!