#Overhead GUI

5 messages · Page 1 of 1 (latest)

vital bobcat
#

Alright so my overhead GUI for my main group and divisions work, but it only works on one player. any idea on how to fix this?
Here is the script.

**local ServerStorage = game:GetService("ServerStorage")
local Tag = ServerStorage.Tag

local CloneTag = Tag:Clone()
local NameTag = CloneTag.NameTag
local RankTag = CloneTag.RankTag

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
CloneTag.Parent = char.Head

    NameTag.Text = player.Name

    if player:GetRankInGroup(32664544) == 255 then
        NameTag.Text = "[Emperor] "..player.Name
    elseif player:GetRankInGroup(32664544) == 254 then
        NameTag.Text = "[Prince] "..player.Name
    elseif player:GetRankInGroup(32664544) == 253 then
        NameTag.Text = "[Princess] "..player.Name
    elseif player:GetRankInGroup(32664544) == 252 then
        NameTag.Text = "[Command Staff] "..player.Name
    elseif player:GetRankInGroup(32664544) == 7 then
        NameTag.Text = "[Officer] "..player.Name
    elseif player:GetRankInGroup(32664544) == 5 then
        NameTag.Text = "[NCO] "..player.Name
    elseif player:GetRankInGroup(32664544) == 4 then
        NameTag.Text = "[Enlisted] "..player.Name
    end
    
    
    
    if player.TeamColor == BrickColor.new("Really black") then
        RankTag.Text = "Heavy Tank Battalion, "..player:GetRoleInGroup(14223009)
        RankTag.TextColor3 = Color3.new(0, 0, 0)
        RankTag.Divicon.Image = "https://www.roblox.com/asset/?id=".."14072104899"
    end
end)

end)**

brave flame
#

main issue is; that is because you only cloned it once, erase Tag:Clone() in local CloneTag and above CloneTag.Parent, write CloneTag = Tag:Clone()

local ServerStorage = game:GetService("ServerStorage")
local Tag = ServerStorage.Tag


local CloneTag
local NameTag = CloneTag.NameTag
local RankTag = CloneTag.RankTag

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        CloneTag = Tag:Clone()
        CloneTag.Parent = char.Head

        NameTag.Text = player.Name

        if player:GetRankInGroup(32664544) == 255 then
            NameTag.Text = "[Emperor] "..player.Name
        elseif player:GetRankInGroup(32664544) == 254 then
            NameTag.Text = "[Prince] "..player.Name
        elseif player:GetRankInGroup(32664544) == 253 then
            NameTag.Text = "[Princess] "..player.Name
        elseif player:GetRankInGroup(32664544) == 252 then
            NameTag.Text = "[Command Staff] "..player.Name
        elseif player:GetRankInGroup(32664544) == 7 then
            NameTag.Text = "[Officer] "..player.Name
        elseif player:GetRankInGroup(32664544) == 5 then
            NameTag.Text = "[NCO] "..player.Name
        elseif player:GetRankInGroup(32664544) == 4 then
            NameTag.Text = "[Enlisted] "..player.Name
        end



        if player.TeamColor == BrickColor.new("Really black") then
            RankTag.Text = "Heavy Tank Battalion, "..player:GetRoleInGroup(14223009)
            RankTag.TextColor3 = Color3.new(0, 0, 0)
            RankTag.Divicon.Image = "https://www.roblox.com/asset/?id=%22..%2214072104899"
        end
    end)
end)
#

improvement; even better, do not make CloneTag variable on top, put it inside the CharacterAdded event, since, i assume youre only gonna use those 3 variable inside the CharacterAdded event.

local ServerStorage = game:GetService("ServerStorage")
local Tag = ServerStorage.Tag

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        local CloneTag = Tag:Clone()
        local NameTag = CloneTag.NameTag
        local RankTag = CloneTag.RankTag
        CloneTag.Parent = char.Head

        NameTag.Text = player.Name

        if player:GetRankInGroup(32664544) == 255 then
            NameTag.Text = "[Emperor] "..player.Name
        elseif player:GetRankInGroup(32664544) == 254 then
            NameTag.Text = "[Prince] "..player.Name
        elseif player:GetRankInGroup(32664544) == 253 then
            NameTag.Text = "[Princess] "..player.Name
        elseif player:GetRankInGroup(32664544) == 252 then
            NameTag.Text = "[Command Staff] "..player.Name
        elseif player:GetRankInGroup(32664544) == 7 then
            NameTag.Text = "[Officer] "..player.Name
        elseif player:GetRankInGroup(32664544) == 5 then
            NameTag.Text = "[NCO] "..player.Name
        elseif player:GetRankInGroup(32664544) == 4 then
            NameTag.Text = "[Enlisted] "..player.Name
        end



        if player.TeamColor == BrickColor.new("Really black") then
            RankTag.Text = "Heavy Tank Battalion, "..player:GetRoleInGroup(14223009)
            RankTag.TextColor3 = Color3.new(0, 0, 0)
            RankTag.Divicon.Image = "https://www.roblox.com/asset/?id=%22..%2214072104899"
        end
    end)
end)
vital bobcat