Group ranking system & regiment

tell me if this is in the wrong section

  1. What do you want to achieve?
  • I want to achieve a group ranking leaderboard with a regiment, or regiments.
  1. What is the issue?
  • It doesn’t work fully, if I’m in a regiment it shows the rank, but if your not in it; it says ‘Guest’, I want it to say N/A instead of Guest, also if your in more than 1 it goes like RGG - BOP etc, also if your not in the regiment it just says N/A if your in NO regiments.
  1. What solutions have you tried so far?
  • I’ve tried looking on here, I also tried just adding destroy: but it didn’t work.
function onPlayerJoin(p)
	local Leaderstats = Instance.new('Folder',p)
	Leaderstats.Name = 'leaderstats'
	
	local GroupRank1 = Instance.new("StringValue",Leaderstats)
	GroupRank1.Name = 'Rank'
	GroupRank1.Value = p:GetRoleInGroup(6355607)
	
	local GroupRank1 = Instance.new("StringValue",Leaderstats)
	GroupRank1.Name = 'Regiment'
	GroupRank1.Value = p:GetRoleInGroup(6355805)
	
	local GroupRank1 = Instance.new("StringValue",Leaderstats)
	GroupRank1.Name = 'Regiment'
	GroupRank1.Value = p:GetRoleInGroup(7108052) if false then
		destroy:
		wait(4)
	end
end
game.Players.PlayerAdded:Connect(onPlayerJoin)



--regiments
ramc = 7217293
rac = 7440679
bop = 7117917
rgr = 7108052
sas = 6355774
rmp = 6355891
pr = 6355841
aac = 6355865
ets = 6355804
gg = 6355805


1 Like

You should probably do a bit of reading on the Developer Hub to understand what you’re coding first before figuring out the problem itself. For example, your use of destroy is completely wrong. Check Instance.Destroy for more information on how to properly use it.

In terms of the “N/A” thing, you can simply add a condition that changes the rank to N/A if it’s fetched as Guest with GetRoleInGroup. Example:

local rank = p:GetRoleInGroup(GROUP_ID_HERE)
if rank == "Guest" then rank = "N/A" end
groupRankValue.Value = rank

I’ll say this in advance: the above code isn’t meant to be copy pasted. If you do it, you will receive an error. It’s up to you, using the advice and the code as a guideline, to figure out how to implement it into your code properly. A bit of research on the Developer Hub might help you.

2 Likes