Checks and Balances

I’m working on a party system that is created through a remote event. When it fires through a text button, the party is created with no issues. The problem is that the player can make multiple parties, something I don’t want them to do. Here’s my code.

CreateParty.OnServerEvent:Connect(function(player)
	print("Party formed")
	local newParty = Instance.new("Team")
	newParty.Parent = game.Teams
	newParty.AutoAssignable = false
	newParty.Name = player.Name .. "'s Party"
	player.Team = newParty
	if Teams:FindFirstChild(player.Name .. "'s Party") then
		
	end
end)

What code can I write to prevent a new instance from being created?

just use a check to see if there isnt already one.

CreateParty.OnServerEvent:Connect(function(player)
	if not game.Teams:FindFirstChild(player.Name.."'s Party") then
		print("Party formed")
		local newParty = Instance.new("Team")
		newParty.Parent = game.Teams
		newParty.AutoAssignable = false
		newParty.Name = player.Name .. "'s Party"
		player.Team = newParty
		if Teams:FindFirstChild(player.Name .. "'s Party") then
			
		end
	end
end)

Thank you! this is what I was thinking, I just didn’t know how to go about it!