Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why can my trail not find the decal ID? [SOLVED]

This PART OF A SCRIPT is supposed to change the texture of a trail in the player. So someone puts a decal id in the input* in a text box and then clicks a button (script.Parent) the trail texture changes to the decal id in the input.

trail.Texture = "http://www.roblox.com/asset/?id=".. script.Parent.Parent.Input.Text --Input*

This is the error I get:

Image "https://assetgame.roblox.com/asset/?id=2780518" failed to load in "Workspace.kittonlover101.Torso.Trail.Texture": Request failed

Thanks!

2 answers

###You should wrap those kinds of things in a pcall, since any kind of text can go in a TextBox.

local input = script.Parent.Parent.Input

local success, msg = pcall(function()
    trail.Texture = "http://www.roblox.com/asset/?id="..input.Text
end)

if success then
    -- code
else
    error("An error occurred:", msg)
end

6 comments

0

Ok im not to sure where to put this? Because it's not working...

0

Also what code do I put in the --if success then-- part?

0

Repeat my line 4 in line 8

0

Ok

0

Humm. Still doesn't work. It puts the decal id in the texture thing, but it still doesn't show up... /:

0

Image "https://assetgame.roblox.com/asset/?id=2148129" failed to load in "Workspace.kittonlover101.Torso.Trail.Texture": Request failed

Sometimes you'll have to subtract the ID by one or sometimes even more than one. I think this is because of images and decals being different but I don't remember.

I would simply do this :

trail.Texture = 'rbxassetid://'..tonumber(input.Text) - 1 -- May sometimes have to subtract more than one sometimes

I use 'rbxassetid://' since it's much shorter. I then use tonumber to get the number of the ID and subtract it by one. Now when you put in the ID, the ID will subtract itself by one and it'll work.

1 comment

0

A decal has a Image.

This discussion is preserved as it was. New answers, comments, and votes are closed.