Problem with group checks

Server Script -

local MinRankInGroup = module.MinRank
local GroupService = game:GetService("GroupService")

game.ReplicatedStorage.BuyingClasses.OnServerEvent:Connect(function(player,Check)

	if Check == "SettingCheck" then
		if player:GetRankInGroup(groupId) >= MinRankInGroup then
			
	
			player.Character.HasRank.Value = true
		end
	end
end)

Local script which is places inside a part -

local gui = script.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.BuyingClasses:FireServer("SettingCheck")
	game.Players.PlayerAdded:Connect(function(player)
		while wait(1)  do
			if player.Character.HasRank.Value == true then
				gui:TweenPosition(
					UDim2.new(0.5, 0,1.426, 0),
					Enum.EasingDirection.InOut,
					Enum.EasingStyle.Linear,
					1,
					false,
					nil
				)
				local gui2 = script.Parent.Parent.Parent.Settings
				gui2:TweenPosition(UDim2.new(0.5, 0,0.5, 0),
					Enum.EasingDirection.InOut,
					Enum.EasingStyle.Linear,
					2,
					false,
					nil)
			end
		end
	end)
end)

I want to make it so that a GUI can be shown if a person in a group has a high rank but it is not working

The value which I am mentioning here is inside the player’s Character, The value doesn’t change and even if I manually change it , it doesn’t work

There are no errors

can I get some help?

Nvm I fixed this problem, It was some script problems