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

How do I GetRankInGroup find ranks?

Why is this code not working? I'm still stuck and the script is now looking like this. Te problem might be somewhere at the rank ("50") It is needed to give Rank 50 in Group more Cash than other ranks. Can some one pls help with this script. (Not free taken)

Wait(7)

local groupId = 3141417 -- Group ID from the Group ranks will be taken from.
	
amountvip = 4 -- This variable is the amount of RIX Vips will get each time.
amount = 2 -- This variable is the amount of RIX we will give each time.
timedelay = 2 -- (600)This variable is the amount of seconds inbetween each time the RIX is rewarded
currencyname = "RIX" -- This is the name of our Currency

while true do
	wait(timedelay)
	for i,v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("leaderstats") and v then
			game.Players.PlayerAdded:connect(function(Player)
    		if Player:GetRankInGroup(groupId) >= 50 then
     			v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amountvip --Award the amount for above 50 rank
    		else
      			v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount --Award the amount for the ranks below 50
    		end
		end)
	end
end

1 answer

This should work!

local groupId = 3141417
game.Players.PlayerAdded:connect(function(Player)
    if Player:GetRankInGroup(groupId) >= 50 then
	  --Award the amount for above 50 rank
    else
           --Award the amount for the ranks below 50
    end
end)

Also, looking at your code:

Wait(3)

local groupId = 3141417 -- Group ID from the Group ranks will be taken from.

amountvip = 4 -- This variable is the amount of RIX Vips will get each time.
amount = 2 -- This variable is the amount of RIX we will give each time.
timedelay = 60 -- (600)This variable is the amount of seconds inbetween each time the RIX is rewarded
currencyname = "RIX" -- This is the name of our Currency

while true do
    wait(timedelay)
    for i,v in pairs(game.Players:GetPlayers()) do
        if v:FindFirstChild("leaderstats") and v then
            if player:IsInGroup(groupId) and player:GetRankInGroup(groupId) >= 50 or 255 then
                v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amountvip
            else
                v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount
            end
        end
    end
end

I think the problem is this line:

if player:IsInGroup(groupId) and player:GetRankInGroup(groupId) >= 50 or 255

should be:

if player:IsInGroup(groupId) and player:GetRankInGroup(groupId) >= 50 or player:GetRankInGroup(groupId) == 255

but all you need to do is:

if player:IsInGroup(groupId) and player:GetRankInGroup(groupId) >= 50

because 255 is bigger than 50!

Let me know if you're still stuck :)

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