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

Making a script to show group ranks on a game?

For some reason there is a error it doesn't work correctly and the output shows no errors heres the code

game.Players.PlayerAdded:connect(function(p)
repeat wait()
until P:FindFirstChild("leaderstats")
local Rank = Instance.new("StringValue", P.leaderstats)
Rank.Name = "GroupName"
Rank.Value = P:GetRankInGroup(00)--Group ID
end)

2 comments

0

Its now saying Workspace.Script:16 attempt to index global 'P' (a nil value)

0

Im trying to make it like there leader board group system on hilton hotel v4

1 answer

✓ Accepted answer

Simple case error.

Your parameter for the function is 'p', but you are using 'P'.

Simply change the parameter to match the case you're using.

game.Players.PlayerAdded:connect(function(P)
	repeat wait() until P:FindFirstChild("leaderstats")
	local Rank = Instance.new("StringValue", P.leaderstats)
	Rank.Name = "GroupName"
	Rank.Value = P:GetRankInGroup(00)--Group ID
end)

5 comments

0

Just did that and it still doesnt work and theres no errors in the output now

0

What doesn't work? Is the StringValue being inserted? Is the value being changed? Elaborate.

0

Well i want it to be like the leader board on hilton hotel on roblox idk how to describe it that well

0

Okay, ah.. the code you provided is just the start of that. If my answer successfully inserts a 'GroupName' stat into all players then it does "work".

0

Well how would i finish it?

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