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

How do I use LoadAsset() without throwing errors?

Asked by
eggxie 2
5 years ago

On line 20 i get the error "HTTP 403" one time, and when i click again, it gives "Bad Request." Basically I am trying to grab the ID that a user types into a textbox, and use that ID as the decal ID in InsertService:LoadAsset. This works when I remove the variable TextInput and instead use a random decal ID.

SERVER SCRIPT (part of it anyway)

ReplicatedStorage = game:GetService("ReplicatedStorage")
InsertService = game:GetService("InsertService")

function morphPlayer(player,TextInput)
    print "decal ID:"(TextInput)


    if player.Character:findFirstChild("Chest") then player.Character.Chest:remove()end
    if player.Character:findFirstChild("Humanoid") ~= nil then

        --===
        local   morph = game.ServerStorage.Morphs:FindFirstChild("Template")
            if  morph == nil then
            print "No template found"
        end
        --===
        if morph then
            local chest = morph.Chest:Clone()
                chest.Parent = player.Character
            local asset = InsertService:LoadAsset(TextInput)
            local decal = asset:FindFirstChildOfClass("Decal")
                decal.Parent = chest.Middle
                decal.Face = "Front"
            local decal2 = decal:Clone()
                decal2.Parent = chest.Middle
                decal2.Face = "Back"

LOCALSCRIPT

Button = script.Parent
Button.MouseButton1Click:Connect(function()
TextInput = Button.Parent.TextBox.Text
    game.ReplicatedStorage.CustomMorph:FireServer(TextInput)
end)
0
Its probably because you dont have HTTP requests on. Go to Settings on the home bar in studio then option then just turn it to on. Should work Protogen_Dev 268 — 5y

Answer this question