Command being ran multiple times

Hi. I’m creating custom commands which allow a player to certain walls invisible, I’ve also added a print statement so it logs when the command is ran. However, upon testing the command (it works) I’ve noticed that the print statement says the command has been ran 16 times; It’s unclear why. Just wondering if I could get some assistance to see what the problem is.

Could the reason be using the descendants function? as I think in the folder there could be around 16 children.

My script for reference

Player.Chatted:Connect(function(Command)
	if Command == "/e :openbackstage" then
		if Player:GetRankInGroup(Group) < MinimumStaffRank then
		GameEvent:FireClient(Player, "CommandEventError", "ERROR RUNNING COMMAND: You do not have permission to use this command.") return end
		for _,OpenBackstageDoors in pairs(CommandDoors:GetDescendants()) do
			if OpenBackstageDoors.Name == "OpenBackstage" then
			OpenBackstageDoors.Transparency = 1 OpenBackstageDoors.CanCollide = false
		end
		print(Player.Name.. " opened backstage doors")
		GameEvent:FireClient(Player, "CommandEventSuccess", "Sucessfully opened Backstage Doors.")
	end
end)
1 Like