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

Leaderboard problem, with "end)" and "elseif", keep having errors or not working?

-------------Double group rank leaderboard brought to you by, NOT MINE--------
GroupID1 = 4249735   --Replace the numbers with the id of group 1.
GroupID2 = 4249735  --Replace the numbers with the id of group 2.

Group1Name = "Ranks"  --Replace No Name(1) with the group name. (Keep parenthesis)
Group2Name = ""  --Replace No Name(2) with the group name. (Keep parenthesis)


--------------Do not edit the following, unless you know what you're doing------


local playerStats = {}
 
 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "leaderstats"
 
     local grouprank = Instance.new("StringValue", leaderstats)
     grouprank.Name = Group1Name
	 local rank = player:GetRoleInGroup(GroupID1)
	
     if rank ~= 0 then
		 grouprank.Value = rank
 	 else
		 grouprank.Value = "Guest"
	 end

     playerStats[player] = leaderstats 

     local secgrouprank = Instance.new("StringValue", leaderstats)
     secgrouprank.Name = Group2Name
	 local rank = player:GetRoleInGroup(GroupID2)
	
		if rank ~= 255 then 
			secgrouprank.Value = "Founder"  
		 	elseif rank >= 245 then
		 secgrouprank.Value = "SHR" 
		elseif rank >= 150 then
		 secgrouprank.Value = "MR" 
		elseif rank >= 6 then
		 secgrouprank.Value = "Worker/LR"  
		elseif rank ~= 5 then
		 secgrouprank.Value = "Trainee"  
		elseif rank ~= 3 then
		 secgrouprank.Value = "Honored" 
		elseif rank ~= 2 then
		 secgrouprank.Value = "Muted!"
		elseif rank ~= 1 then
		 secgrouprank.Value = "Hotel Member"
		else 
			secgrouprank.Value = "Guest to Hotel"
	    end
 end)

-- Not working - If change "elseif" to "else if" "End)" will say "expected identifier, got 'If'" 
-- I am confused Probably overthinking it.

3 comments

0

"else if" isn't a thing in LUA

0

elseif is a thing

0

It's called Lua not LUA. LUA means "Love U Always", of course elseif is not a thing in Love U Always.

1 answer

there are supposed to be two "end" instead of one before "end)"

the last part should be

		end
	end
end)

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