I'm encountering some problems with a TryOn function that I'm using in my mannequin system. The main issue is that after the remote used for trying on clothing gets called once it sort off breaks and whenever I try to try on other clothing It equips the player with both the Shirt and the Pants of the mannequin instead of only one of them-- in my debug script it prints both Shirt and Pants instead of only one of them. Here's the main function:

local function TryOn(p, player, ClothingId, Action)
	if Action == "Wear" then
		print("ACTION: wear clothing.")
		
		local ClothingType = MarketplaceService:GetProductInfo(ClothingId).AssetTypeId
		
		--- 11 is the AssetType Id for Shirts
		--- 12 is the AssetType Id for Pants
		if ClothingType == 11 or Enum.AssetType.Shirt then
			print("Shirt") --/ equip player shirt, print function for debugging
		elseif ClothingType == 12 or Enum.AssetType.Pants then
			print("Pants") --/ equip player pants, print function for debugging
		end
	elseif Action == "Reset" then
		print("ACTION: reset.")
		player.Character.Shirt.ShirtTemplate = player:FindFirstChild("originalShirt").Value
		player.Character.Pants.PantsTemplate = player:FindFirstChild("originalPants").Value
	end
end

TryOnEvent.OnServerEvent:Connect(TryOn)

2 comments

0

Can you show the local script that use TryOnEvent:FireServer()?

0

TryOn.MouseButton1Click:Connect(function() TryOnEvent:FireServer(Player, CLOTHING_ID, "Wear") end)