Hello! So I have here a working shirt and face ID importer, but I don’t know how to make a hat/accessory importer. Shirts and the like are a bit easier, since they use textures.
I have this script in the GUI:
local MarketplaceService = game:GetService("MarketplaceService")
local RS = game:GetService("ReplicatedStorage")
local Frame = script.Parent
Frame.FaceGO.Activated:Connect(function()
local Info = MarketplaceService:GetProductInfo(Frame.FaceId.Text)
RS.Remotes.ChangeOutfit:FireServer(Info,nil,nil,nil,Info.AssetId)
end)
Frame.ShirtGO.Activated:Connect(function()
local Info = MarketplaceService:GetProductInfo(Frame.ShirtId.Text)
RS.Remotes.ChangeOutfit:FireServer(Info, Info.AssetId)
end)
Frame.PantsGO.Activated:Connect(function()
local Info = MarketplaceService:GetProductInfo(Frame.PantsId.Text)
RS.Remotes.ChangeOutfit:FireServer(Info,nil,Info.AssetId)
end)
Frame.HatGO.Activated:Connect(function()
local Info = MarketplaceService:GetProductInfo(Frame.HatId.Text)
RS.Remotes.ChangeOutfit:FireServer(Info,nil,Info.AssetId)
end)
And this one in ServerScriptService
local RS = game:GetService("ReplicatedStorage")
RS.Remotes.ChangeOutfit.OnServerEvent:Connect(function(plr, Info, ShirtId, PantsId, TShirtId, HatId, faceId)
local char = plr.Character
if ShirtId and Info.AssetTypeId == 11 then
char.Shirt.ShirtTemplate = game:GetService("InsertService"):LoadAsset(ShirtId).Shirt.ShirtTemplate
end
if PantsId and Info.AssetTypeId == 12 then
char.Pants.PantsTemplate = game:GetService("InsertService"):LoadAsset(PantsId).Pants.PantsTemplate
end
if TShirtId and Info.AssetTypeId == 2 then
char["T-Shirt"].Graphic = game:GetService("InsertService"):LoadAsset(TShirtId)["Shirt Graphic"].Graphic
end
if HatId and Info.AssetTypeId == 42 then
local hat = game:GetService("InsertService"):LoadAsset(HatId)
hat.Parent = char
end
print(Info.AssetTypeId)
if faceId and Info.AssetTypeId == 18 or (Info.AssetTypeId == 13 or Info.AssetTypeId == 1) then
if Info.AssetTypeId == 13 or Info.AssetTypeId == 1 then
char.Head.face.Texture = "rbxthumb://type=Asset&id=" .. faceId .. "&w=420&h=420"
else
char.Head.face.Texture = game:GetService("InsertService"):LoadAsset(faceId).face.Texture
end
end
end)