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

How to change gui on everyone's screen?

Asked by 10 years ago

I want to make it so everyone's screen is changed when someone clicks a button. Any idea how?

1 answer

Log in to vote
0
Answered by
Destrings 406 Moderation Voter
10 years ago

Just iterate over the players. If the button is on a GUI then you will need to run the code on server since a client doesn't have knowledge of other players GUIs. You could use RemoteFunctions

Code on client:

script.Parent.TextButton.MouseButton1Click:connect(function()
    game.ReplicatedStorage.RemoteFunction:InvokeServer()
end)

Code on server:

game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(player, arg)
    for k, v in next, game.Players:GetPlayers() do
        v.PlayerGui.ScreenGui.Frame.BackgroundColor3 = BrickColor.Random().Color
    end
end
Ad

Answer this question