Help With Rank Handling Script

I want a Rank Handler, where your name and rank display above your head according to a Roblox group, but I want a certain user to have a different rank than his group rank.

Basically I think I have a script but it is not working, there are no errors in the script but it just displays the normal group rank, not the name that I want.


I’ve looked for answers but cannot find anything.

If anyone could help me with what’s the issue or maybe fix the script for me it’d be greatly appreciated. Thanks.

local groupID = 8008122
local player = game.Players.LocalPlayer
local id = 356235180


game.Players.PlayerAdded:Connect(function(player)
	local groupRank = player:GetRoleInGroup(groupID)
	local clone = script.Rank:Clone()
	clone.Parent = game.Workspace:WaitForChild(player.Name).Head
	clone.Frame.Name1.Text = player.Name or if player.UserId == 356235180 then
		clone.Frame.Rank.Text else "Owner"
	clone.Frame.Rank.Text = groupRank 
	
	player.CharacterAdded:Connect(function()
		local groupRank = player:GetRoleInGroup(groupID)
		local clone = script.Rank:Clone()
		clone.Parent = game.Workspace:WaitForChild(player.Name).Head
		clone.Frame.Name1.Text = player.Name
		clone.Frame.Rank.Text = groupRank
	end)


end)

Were is your out put can you show me the output?

Ok two things what the hell is these part?
clone.Frame.Name1.Text = player.Name or if player.UserId == 356235180 then
clone.Frame.Rank.Text else “Owner”
these doesnt make scence in scripting Explain what were you tying there
and why are you cloning script.Rank two time?

Something I found: why did you state the game.Players.LocalPlayer version and the PlayerAdded argument? The first one is unnecessary.

It should look like this:

clone.Frame.Name1.Text = player.Name
if player.UserId == 356235180 then
    clone.Frame.Rank.Text else "Owner"
else
    clone.Frame.Rank.Text = groupRank
end
clone.Frame.Rank.Text = groupRank

I see you have localPlayer. Make sure this is a server script.

thats what im saying its unnecessary to clone the rank 2 times only clone it whend the character is added

1 Like

Yes it is in server scripts, I added onto this, I originally didn’t script it, where in the script should it go?

For being honest anywere but i recomend in server script

I added onto this script, the script was originally this:

local groupID = 8008122


game.Players.PlayerAdded:Connect(function(player)
	local groupRank = player:GetRoleInGroup(groupID)
	local clone = script.Rank:Clone()
	clone.Parent = game.Workspace:WaitForChild(player.Name).Head
	clone.Frame.Name1.Text = player.Name
	clone.Frame.Rank.Text = groupRank 
	
	player.CharacterAdded:Connect(function()
		local groupRank = player:GetRoleInGroup(groupID)
		local clone = script.Rank:Clone()
		clone.Parent = game.Workspace:WaitForChild(player.Name).Head
		clone.Frame.Name1.Text = player.Name
		clone.Frame.Rank.Text = groupRank
	end)


end)

I’m not a scripter I just tried to do what I thought might be right but its not haha

I don’t know if this works or not but I made this

local groupID = 8008122

game.Players.PlayerAdded:Connect(function(player)
	local groupRank = player:GetRoleInGroup(groupID)
	local clone = script.Rank:Clone()
	
	if player.Character then
		clone.Parent = player.Character.Head
	
		-- Assuming I have read it all correctly, this will give the owner of the group the "Owner" title instead of his rank title
		if player.UserId == 356235180 then
			clone.Frame.Rank.Text = "Owner"
		else
			clone.Frame.Rank.Text = groupRank
		end
	
		clone.Frame.Name1.Text = player.Name
	end
end)
1 Like

Yes bless you thank u so much it worked

1 Like

Can you test and see if it works when you reset? I don’t know if it does, this script is just a solution

If it doesn’t, maybe try this?

local groupID = 8008122

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		local groupRank = player:GetRoleInGroup(groupID)
		local clone = script.Rank:Clone()

		if player.Character then
			clone.Parent = player.Character.Head
	
			-- Assuming I have read it all correctly, this will give the owner of the group the "Owner" title instead of his rank title
			if player.UserId == 356235180 then
				clone.Frame.Rank.Text = "Owner"
			else
				clone.Frame.Rank.Text = groupRank
			end
	
			clone.Frame.Name1.Text = player.Name
		end
	end)
end)

Oh yeah, when I reset it doesn’t, the whole UI disappears. I will plug in the other script to see if it works.

Yes this one does work when you reset, thx

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.