Check-in Sytem, with naming

Hello, developers, I am making a check-in system, and I have run into 2 issues, 1st being if the player is ranked over the specified rank, it doesnt give the tool, further more it doesnt name the player.

local ASSET_ID = 5644324894
local MarketplaceService = game:GetService("MarketplaceService")
local PlayerOwnsAsset = MarketplaceService.PlayerOwnsAsset
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
local groupid = 6418380
local grouprank = 3

script.Parent.MouseButton1Click:Connect(function(plr)
	local success, doesPlayerOwnAsset = pcall(PlayerOwnsAsset, MarketplaceService, player, ASSET_ID)
	if doesPlayerOwnAsset then
		game.ReplicatedStorage["First Class"]:Clone().Parent = player.Backpack
		plr.Name = plr.Name.."[] First Class"
	elseif plr:GetRankInGroup(groupid) >=grouprank then
		game.ReplicatedStorage["First Class"]:Clone().Parent = player.Backpack
		plr.Name = plr.Name.."[] First Class"
	else
		game:GetService("MarketplaceService"):PromptPurchase(player, ASSET_ID)
		wait(4)
		script.Parent.parent.Visible=false
		script.Parent.Parent.Parent.HomePage.Visible=true

	end
end)

Hey.

First issue:
Could you try to change the code with a space after the operator >=.

Second issue:
Try to change that you get the player from game.Players

The issue I see is that you use game.Players[plr]. This will not work. Use plr instead.

Alright, I will try that, however with using game.Players Wont it change the name of everyone?

no because you are using game.Players[plr].