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

Is there a way to make an auto updating group leaderboard?

Hello.

I'm trying to make a script that sets a player's leaderstats to their group rank. It does that, but it doesn't update unless every player leaves the game.

function joined(plr)
	local ls = Instance.new("Model")
	ls.Name = "leaderstats"
	ls.Parent = plr
	local st = Instance.new("StringValue")
	st.Parent = ls
	st.Name = "Rank"
		plr.CharacterAdded:Connect(function(char)
			local plrname = char.Name
			 local rank = game.Players[plrname]:GetRoleInGroup(3693179)
				if rank ~= 0 then
					plr.leaderstats.Rank.Value = rank
				else
					 plr.leaderstats.Rank.Value = "Guest"
				end
		end)
end

game.Players.PlayerAdded:Connect(joined)

I've been trying to make this for a while now, but I can't seem to get it right.

Help would be appreciated.

Thanks

1 comment

0

I tried to get it to update when the player resets

1 answer

✓ Accepted answer

Assuming GetRoleInGroup functions the same as GetRankInGroup, the result of the function (the role the player has) is cached. This means that when the function is called again from a server script, it will give the same result, even if the user has since changed ranks in the group.

To fix this, you can get up-to-date information on the player's rank from a local script. This would involve invoking the client with a remote function and checking the result from the server. However, this has its own problems, as exploiters can return an incorrect role & therefore lie about what group role they have.

So in conclusion, checking the group rank repeatedly from the server will not give you updated results, while checking from the client will make it vulnerable to exploiters. There is no real way around this, but the option I would recommend the most is to only check the rank when the player first joins from the server, as it is a secure approach.

3 comments

0

Alright thanks, I have a password system for all of my remotes, so I guess I'll go with that.

0

No password system for remotes is secure, there is no remote that can't be exploited. Exploiters can see arguments passed to and from the remotes & all your local script code, allowing them to pick up passwords sent.

0

A lock only keeps innocent people out.

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