GetRankInGroup "Not Vaild Member of Players"

Hello developers, I am making this script where your Group rank will show up on a gui, here is what ive got

local Plrs = game:GetService("Players")
local PlrINFO = script.Parent.Main.PlrINFO

local GroupID = 2780115 
local Yr7 = 2
local Yr8 = 10
local Yr9 = 25
local Yr10 = 26
local Yr11 = 27
local Sixth = 29



if Plrs:GetRankInGroup(GroupID) <= Yr7 then
	PlrINFO.PlayName.Text = "Year: Year7"
elseif Plrs:GetRankInGroup(GroupID) <= Yr8 then
	PlrINFO.PlayName.Text = "Year: Year8"
elseif Plrs:GetRankInGroup(GroupID) <= Yr9 then
	PlrINFO.PlayName.Text = "Year: Year9"
elseif Plrs:GetRankInGroup(GroupID) <= Yr10 then
	PlrINFO.PlayName.Text = "Year: Year10"
elseif Plrs:GetRankInGroup(GroupID) <= Yr11 then
	PlrINFO.PlayName.Text = "Year: Year11"
elseif Plrs:GetRankInGroup(GroupID) <= Sixth then
	PlrINFO.PlayName.Text = "Year: Sixth Form"
else
	PlrINFO.PlayName.Text = "Year: Staff"
end

The error that it comes up with is “GetRankInGroup is not a valid member of Players “Players”” And I don’t know what to do, as this is what my research has told me to do.

1 Like

:GetRankInGroup is a function of Player not Players. If you’re using a LocalScript you can get the player by using the LocalPlayer property of Players:

local Player = Plrs.LocalPlayer
--and replace Plrs:GetRankInGroup with Player:GetRankInGroup
1 Like

Alright ok, thank you, i will try it now!