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

Why does this highest number finder not work?

Asked by 6 years ago
Edited 6 years ago
game.Players.PlayerAdded:connect(function(Player)

local maingroup = Player:GetRankInGroup(3240451)
local securitygroup = Player:GetRankInGroup(3415017)

if maingroup >= securitygroup then

    function onPlayerRespawned(newPlayer)
        wait(1)
        if newPlayer then
            gui=Instance.new("BillboardGui")
            gui.Parent=newPlayer.Character.Head
            gui.Adornee=newPlayer.Character.Head
            gui.Size=UDim2.new(4,0,2,0)
            gui.StudsOffset=Vector3.new(0,3,0)
            texta=Instance.new("TextBox")
            texta.Size=UDim2.new(1,0,1,0)
            texta.TextStrokeTransparency = 0
            texta.TextStrokeColor3 = Color3.new(250,0,0)
            texta.BackgroundTransparency = 1
            texta.Text = (newPlayer:GetRoleInGroup(3240451) .. " - Milkz Cafe")
            texta.TextColor3 = Color3.new(250,250,250)
            texta.Parent=gui
            texta.TextColor3 = Color3.new(250,250,250)
        end
    end

    function onPlayerEntered(newPlayer)
        newPlayer.Changed:connect(function (property)
            if (property == "Character") then
                onPlayerRespawned(newPlayer)
            end
        end)
    end

else

    function onPlayerRespawned(newPlayer)
        wait(1)
        if newPlayer then
            gui=Instance.new("BillboardGui")
            gui.Parent=newPlayer.Character.Head
            gui.Adornee=newPlayer.Character.Head
            gui.Size=UDim2.new(4,0,2,0)
            gui.StudsOffset=Vector3.new(0,3,0)
            texta=Instance.new("TextBox")
            texta.Size=UDim2.new(1,0,1,0)
            texta.TextStrokeTransparency = 0
            texta.TextStrokeColor3 = Color3.new(0,0,0)
            texta.BackgroundTransparency = 1
            texta.Text = (newPlayer:GetRoleInGroup(3415017) .. " - Milkz Security")
            texta.TextColor3 = Color3.new(250,250,250)
            texta.Parent=gui
            texta.TextColor3 = Color3.new(250,250,250)
        end
    end

    function onPlayerEntered(newPlayer)
        newPlayer.Changed:connect(function (property)
            if (property == "Character") then
                onPlayerRespawned(newPlayer)
            end
        end)
    end

end
end)

What I want it to do is find what group a player is highest in and print a message when its found. Got any ideas? It shows the group tag above player heads for maingroup, but doesn't do anything for securitygroup. Pls help. Edit: I know there are 3 PlayerAdded functions but how would I fix this?

2
You connect a new function to the player added event in a player added event?? User#5423 17 — 6y
0
Uhm... I'm a noob, how would I fix it? MachoPiggies 526 — 6y
0
Is is a game or a group's game? Araknala 14 — 6y
0
Groups game MachoPiggies 526 — 6y
0
I would upvote the first comment if I could. xDDDDD MachoPiggies 526 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

have a playeradded in a playeradded event that is just stupid, also that entire if statement is useless because you could just insert the groupIds in a table and do local groupid = math.max(unpack(groupids))

0
I updated the script, still not working? MachoPiggies 526 — 6y
Ad

Answer this question