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

Im trying to change the Logo of a ImageLabel on a GUI by chat command?

Heres what I have so far?

local Permitted = {"iSidersz", "Player"}
local ALogo = game.StarterGui.Scoreboard.Frame.AwayLogo
local HLogo = game.StarterGui.Scoreboard.Frame.HomeLogo

game.Players.PlayerAdded:connect(function(plr)
    for i,v in pairs(Permitted) do

        if v:lower() == plr.Name:lower() then

            plr.Chatted:connect(function(msg)

                if msg:lower() == "away/orl" then
 ALogo.Image = script.Parent.orli.ID
                    
                end

            end)

        end

    end
end)

5 comments

0

To change this image label, I would recommend getting the image labels from the PlayerGui

0

What do you mean by player gui?

0

You're changing them from the startergui, which won't change in-game. You need to get the player's playergui through player.PlayerGui.

0

So a logo would be player instead of starter gui

0

Yes. And HLogo. Referencing StarterGui in this will not work, anywhere in the script.

1 answer

✓ Accepted answer

One change to the code I made is using a different variation of the for loop. Another problem I see in your code is you are trying to set "game.StarterGui.Scoreboard.Frame.AwayLogo" & "game.StarterGui.Scoreboard.Frame.HomeLogo". I would recommend using this instead

local Permitted = {"iSidersz", "Player"};
--local ALogo = game.StarterGui.Scoreboard.Frame.AwayLogo;
--local HLogo = game.StarterGui.Scoreboard.Frame.HomeLogo;

game.Players.PlayerAdded:connect(function(plr)
    for i = 1, #Permitted do
        if plr.Name:lower() == Permitted[i]:lower() then
            plr.Chatted:connect(function(msg)
                if msg:lower() == "away/orl" then
			for a,b in pairs(game.Players:GetChildren()) do
				b.PlayerGui.Scoreboard.Frame.AwayLogo.Image = script.Parent.orli.ID;
			end;
                end;
            end);
        end;
    end;
end);

This code will go through and take each and every player from "game.Players" and open their PlayerGui and find the scoreboard and change the value there instead of trying to change the one in StarterGui.

2 comments

0

Not working but its probably just 1 small error

0

Wait is Local alogo and hlogo supposed to be commented

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