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

The TextLabel's text wont change for some reason?

Asked by 3 years ago
Edited 3 years ago

The Text in the UI won't change, this only happened when I added anything to do with Regiment, before that The Username would show up, Any help?

local Groupservice = game:GetService("GroupService")
local Groups = {
    "9337585",
    "9337510",
    "9337562",
    "9337514",
    "9337548",
}




game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)

        local GroupID = "9275037"
        local GuiClone = script.BillboardGui:Clone()
        GuiClone.Parent =  Character:WaitForChild("Head")
        local TextLabel = GuiClone.Frame.TextLabel
        local GroupRank = Player:GetRoleInGroup(GroupID)

        local function FindRegimentGroup()
            for i, id in pairs(Groups) do
                local InRegiment = Player:IsInGroup(id)
                if InRegiment then
                    local GroupRegimentRank = Player:GetRoleInGroup(id)
                    return id
                end
            end


        FindRegimentGroup()

        local Regiment = Player:GetRoleInGroup(FindRegimentGroup())

        if GroupRank and Regiment then
            TextLabel.Text = Player.Name.."\n"..GroupRank.."\n"..Regiment
        elseif not GroupRank and not Regiment then
            TextLabel.Text = Player.Name.."\nGuest"
        elseif GroupRank and not Regiment then
            TextLabel.Text = Player.Name.."\n"..GroupRank.."\nRegimental Recruitment"
        end

        end
    end)
end)

1 answer

Log in to vote
0
Answered by 3 years ago

Is this on a script or local script, because scripts wont work to change the persons Gui, since scripts are not really good for changing text labels or text colors. Things that are handled locally such as Guis are usually done by local scripts, so in conclusion if you do need this to be a script then I suggest putting a remote event and firing it to a client which can change the text of the label.

Ad

Answer this question