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?
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))