Script Failing to get players Rank in Group

Hey! :wave:

I’m currently working on a script that only allows you to press a GUI button if you’re a certain rank in a group, however it doesn’t work. Any help with this would be appreciated - the script is shown down below. Thanks! :heart:

OrdersBoardFrame.ChildAdded:Connect(function(OrderFrame)
	if OrderFrame:WaitForChild("ClaimButton") then
		OrderFrame.ClaimButton.MouseButton1Click:Connect(function(plr)
			if plr:GetRankInGroup(7331168) >= 4 then
			if booleanvalue == false then
				claimOrder(OrderFrame)
				booleanvalue = true
				end
			end
		end)
	end
end)

Fixed it on my own, thank you to everyone who tried to help.

copy n paste this

OrdersBoardFrame.ChildAdded:Connect(function(OrderFrame)
	if OrderFrame:WaitForChild("ClaimButton") then
		OrderFrame.ClaimButton.MouseButton1Click:Connect(function(plr)
			if plr:GetRankInGroup(7331168) >= 4 then
				if booleanvalue == false then
					claimOrder(OrderFrame)
					booleanvalue = true
				end
			end
		end)
	end
end)