Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this highest number finder not work?

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?

5 comments

2

You connect a new function to the player added event in a player added event??

0

Uhm... I'm a noob, how would I fix it?

0

Is is a game or a group's game?

0

Groups game

0

I would upvote the first comment if I could. xDDDDD

1 answer

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

1 comment

0

I updated the script, still not working?

This discussion is preserved as it was. New answers, comments, and votes are closed.