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

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

Asked by 8 years ago

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)

~~~~~~~~~~~~~~~~~

0
To change this image label, I would recommend getting the image labels from the PlayerGui yoshi8080 445 — 8y
0
What do you mean by player gui? iSidersz 70 — 8y
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. Pyrondon 2089 — 8y
0
So a logo would be player instead of starter gui iSidersz 70 — 8y
0
Yes. And HLogo. Referencing StarterGui in this will not work, anywhere in the script. Pyrondon 2089 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.

0
Not working but its probably just 1 small error iSidersz 70 — 8y
0
Wait is Local alogo and hlogo supposed to be commented iSidersz 70 — 8y
Ad

Answer this question