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

How do I make this script actually work and appear on the screen?

Asked by 5 years ago

This script is not working, meaning it doesn't show on the screen.

I currently have it in serverscriptservices, I don't know if that is where it goes.

local mainGroup = 3345195    -- Main Group ID

local regimentTags = {
--   Regiment   Regiment        In-game
--    Group          Tag            Team
--     ID                        Name
    {3345195,      "Regimental Recruitment",     "BA Personnel"},
    {4038679,      "ETS",     "Education and Training Services"},
    {4427001,      "RMP",     "Royal Military Police"},
    {3979521,      "ETS",     "Education & Training Service"},
    {3742396,      "GG",     "Grenadier Guards"},
    {12680,      "SAS",     "Special Air Services"},
    {4067838,      "RIF",     "Royal Intelligence Force"},


}

game.Players.PlayerAdded:connect(function(Player)


    local pRank = Player:GetRoleInGroup(mainGroup)
    local rRank
    local rRole 
    Player.Team = game.Teams["Civilians"]
    for i, v in ipairs(regimentTags) do
        if (Player:IsInGroup(v[1])) then
            if(rRank == nil) then
                rRank = v[2]
            else        
                rRank = rRank.." " .. v[2]
            end
            rRole = Player:GetRoleInGroup(v[1])
            Player.Team = game.Teams[v[3]]
        end
    end 
    if (Player:GetRankInGroup(mainGroup) == 252)  then Player.Team = game.Teams["Headquarters"] end
    if Player:GetRankInGroup(mainGroup) > 1 then Player.Team = game.Teams["Basic Training"] end
    if Player:GetRankInGroup(mainGroup) > 108 then Player.Team = game.Teams["Trainees"] end
    if (Player:GetRankInGroup(mainGroup) == 160)  then Player.Team = game.Teams["Officers"] end

    if rRank == nil then rRank = "Regimental Recruitment" end   
    local ui = script.Rank:Clone()
    ui.Parent = Player.Character
    ui.Adornee = Player.Character.Head

    while not Player.Character.Humanoid do wait() end
    Player.Character.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
    local frame = ui.Frame
    local name = frame.Name1
    local role = frame.TextLabel

    name.Text = Player.Name
    role.Text = pRank
    if (string.len(rRank) < 4) then
        frame.TextLabel2.Text = rRank.. " | " .. rRole

    else
        frame.TextLabel2.Text = rRank
    end

    local leaderstats = Instance.new("Model")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = Player

    local rank = Instance.new("StringValue")
    rank.Name = "Rank"
    rank.Value = pRank
    rank.Parent = leaderstats

    local regiment = Instance.new("StringValue")
    regiment.Name = "Regiment"
    regiment.Value = tostring(rRank)
    regiment.Parent = leaderstats


    name.TextColor3 = Player.Team.TeamColor.Color
    role.TextColor3 = Color3.fromRGB(10, 10,10)
    frame.TextLabel2.TextColor3 = Player.Team.TeamColor.Color
end)

Answer this question