Command not working

I am trying to make a script when you say “!command” a gui will pop up for a rank higher in my group

script:

local GroupId = 7446763 
local MinimumRank = 9

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		local HelpUI = Player.PlayerGui.HelpUI
		if Message == "!help" then
			MinimumRank.PlayerGui.HelpUI.Enabled = true
		end
	end)
end)
1 Like
MinimumRank.PlayerGui.HelpUI.Enabled = true

should be

Player.PlayerGui.HelpUI.Enabled = true

Check the rank when checking the message

if Message == "!help" and Player:GetRankInGroup(GroupId) >= 9  then

Also I recommend handling UI on the client