event.OnServerEvent:Connect(function(player,id,imageid,clothesname)

	local mystring = string.lower(clothesname)
	local character = player.Character
	function MPS.ProcessReceipt(info)
		local status = Enum.ProductPurchaseDecision.NotProcessedYet
		
		pcall(function()
			local player = game.Players:GetPlayerByUserId(info.PlayerId)
			if player then
				if info.ProductId == imageid then
					print("owkay")
					if string.find(mystring,"shirt") or string.find(mystring,"suit") or string.find(mystring,"hoodie") or string.find(mystring,"sweater") then
						local shirt = character:WaitForChild("Shirt")
						if shirt then
							shirt.ShirtTemplate = ("http://www.roblox.com/asset/?id="..id)
						end
					elseif string.find(mystring,{"pants","jeans","sweatpants","shorts"}) then
						local pants = character:WaitForChild("Pants")
						if pants then
							pants.PantsTemplate = ("http://www.roblox.com/asset/?id="..id)
						end
					end
					local purchases = player:WaitForChild("leaderstats").Purchases
					purchases.Value = purchases.Value + 1
					print("test4")

					status = Enum.ProductPurchaseDecision.PurchaseGranted
				end
			end
		end)
		return status
	end
	
end)

this is the code the processReceipt function doesnt fire idk if its smn to do with the remote or cuz i cant use it with 3rd party models or some coding mistake ?

1 comment

0

Make sure to use proper grammar.