Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Cannot set player's shirt, help?

Asked by 6 years ago

Hey, so, I've been trying to make a GUI that swaps the player's shirt to the ID put in, here's the code, as the script is basically another 300 lines of other code, I'll only be posting a small snippet:

customItems.Submit.MouseButton1Click:Connect(function()
    if string.len(customItems.CustomID.Text) ~= 0 then
        if string.sub(customItems.Header.Text, 8) == "SHIRT" then
            print("shirt ID")
            local char = game.Players.LocalPlayer.Character
            if char ~= nil then
                local shirtToChange = char:FindFirstChild("Shirt")
                if shirtToChange ~= nil then
                    local mplace = game:GetService("MarketplaceService")
                    local exists = pcall(function()
                        mplace:GetProductInfo(customItems.CustomID.Text)
                    end)
                    if exists then
                        print("Shirt changed")
                        shirtToChange.ShirtTemplate = "rbxassetid://".. mplace:GetProductInfo(customItems.CustomID.Text).AssetId
                    end
                else
                    shirtToChange = Instance.new("Shirt", char)
                end
            else
                print("Player no longer exists")
            end
        elseif string.sub(customItems.Header.Text, 8) == "PANTS" then
            print("pants ID")

        else
            error("No type of ID was set for CustomID")
        end 
    else
        print("Not long enough ID")
    end
end)

The error thrown is:

16:44:26.458 - Image "https://assetgame.roblox.com/asset/?id=2034242601" failed to load in "Workspace.RaggaMuffinzz.Humanoid.Clothes": Request failed

0
try to test ingame? adamdeno 2 — 6y
0
I already have RaggaMuffinzz 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Hello,

The reason it doesn't work is because you are trying to link a product in the catalog rather than linking the actual texture.

The actual texture will look like this: Imgur

~Frag

Ad

Answer this question