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

GetRoleInGroup, GetRankInGroup, If statements, and gui Text help?

Asked by 8 years ago

I have made a script which was working. I then added the if/elseif statements with the GetRole and GetRank inGroup functions. They don't work anymore, any help?

Also, the player's name is still visible. There are no errors either.

local InjuryRarity  = {1,3,3,3,3,3,2,1} -- Frequency relative to eachother
local Injuries      = {"Heart Attack", "Chest Pain", "Abdominal Pain", "Broken Leg", "Broken Arm", "Headache", "Toothache", "Foreign Object"}

game.Players.PlayerAdded:connect(function(plr)
    plr.NameDisplayDistance = 0
    plr.ViewerType = "None"
    plr.CharacterAdded:connect(function(Character)
        -- Get random injury
        local seed          = math.random(1, sum(InjuryRarity))
        local chosenKey     = overflow(InjuryRarity, seed)

        local gui = script.BillboardGui:Clone()
        local id = 2567972

        if plr:GetRankInGroup(id) <= 3 then
            gui.TextLabel.Text = (plr.Name.. ", " .. Injuries[chosenKey])
            gui.Adornee = Character:WaitForChild("Head")
            gui.Parent = Character:WaitForChild("Head")
        elseif plr:GetRankInGroup(id) >= 4 then
            gui.TextLabel.Text = (plr.Name.. ", " .. plr:GetRoleInGroup (id)) -- Display their rank
            gui.Adornee = Character:WaitForChild("Head")
            gui.Parent = Character:WaitForChild("Head")
        end

    end)
end)

Answer this question