Issues with GetRankInGroup()

I’m having an issue with this LocalScript and it seems there’s no error in the output, so I was wondering if anyone acknowledges a solution to this. I’m attempting to get the player’s correct rank and if they’re the suitable rank, it shows a button for them only. If they’re not suitable for that rank provided, it doesn’t show it - but I simply can’t find a solution. Here’s my script:

local frame = script.Parent
local button = frame.Opener

game.Players.PlayerAdded:Connect(function(plr)
	if plr:GetRankInGroup(3788654) == 255 then
		button.Visible = true
	else
		button.Visible = false
	end
end)

image

Nevermind, found a solution for this. The script didn’t gather the LocalPlayer, so it could’ve got confused there. For anyone wondering, I changed game.Players.PlayerAdded:Connect(function(plr) to local plr = game.Players.LocalPlayer