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

How do i make a GUI change for all Players on Server?

Asked by 6 years ago
function Amarelo()
    for i,v in pairs(game.Players:GetPlayers()) do
        v.PlayerGui.Gui1.Frame.cor.BackgroundColor3 = Color3.new(255, 255, 0)
        v.PlayerGui.Gui1.Frame.TextLabel.Text = "Ocorreu alguma coisa, sem ultrapassagens, diminua sua velocidade!"
    end
end

script.Parent.MouseButton1Click:connect(Amarelo)

In Output shows this:

PlayerGui is not a valid member of Player

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

PORTUGUEASE

Olá, Bruno_GamerX!

Nos meus testes, game.Players:GetPlayers() não funcionou, então eu troquei para game.Players:GetChildren o que resolveu meu probrema, eu só tive que mudar poucas coisas no script =D

function Amarelo()
    for i,v in pairs(game.Players:GetChildren()) do
        game.Players[v].PlayerGui.Gui1.Frame.cor.BackgroundColor3 = Color3.new(255, 255, 0)
        game.Players[v].PlayerGui.Gui1.Frame.TextLabel.Text = "Ocorreu alguma coisa, sem ultrapassagens, diminua sua velocidade!"
    end
end

script.Parent.MouseButton1Click:connect(Amarelo)

Boa Sorte com seus Jogos!

ENGLISH

Hello, Bruno_GamerX!

On my tests, game.Players:GetPlayers() didn't worked, so I changed it to game.Players:GetChildrenand that solved my problem, I just had to change somethings on your script =D

function Amarelo()
    for i,v in pairs(game.Players:GetChildren()) do
        game.Players[v].PlayerGui.Gui1.Frame.cor.BackgroundColor3 = Color3.new(255, 255, 0)
        game.Players[v].PlayerGui.Gui1.Frame.TextLabel.Text = "Ocorreu alguma coisa, sem ultrapassagens, diminua sua velocidade!"
    end
end

script.Parent.MouseButton1Click:connect(Amarelo)

Good Luck with your games!

Ad

Answer this question