How to make Decal id compatible with Texture by script (Decal, Trails, etc)

I’m making a GamePass where you can have a custom image trail, how it works is you put the decal id link into the Textbox then click accept. But every time I try to put the link inside it doesn’t work.

The script definitely works, it does indeed set the link to the texture, but it doesn’t show the image…

does anybody have a solution?

 -- client 
    script.Parent:WaitForChild("Accept").MouseButton1Click:Connect(function()
if Slow == true then
	
else
	Slow = true
 -- script.Trail:FireServer(    decal link you put                    ,gamepassID)
	script.Trail:FireServer(script.Parent:WaitForChild("TextBox").Text,10483733)
	wait(2)
	Slow = false
end



end)



  -- server
   local MS = game:GetService('MarketplaceService')
 script.Parent.OnServerEvent:Connect(function(Player,DecalID,GamepassID)
	

if MS:UserOwnsGamePassAsync(Player.UserId, GamepassID) then
	
	local Character = Player.Character
	Character.HumanoidRootPart.Trail.Texture = (DecalID)
	
end
 end)
1 Like

Intentional Bump

Is this still an issue for you? I have the exact same problem only for a tools handle.

I’m concatenating a string with my TextureId, but it doesn’t show any content…

This is what my script looks like:

local Texture1 = Instance.new("Texture", LuckyNumberatorHandle)
local Texture2 = Instance.new("Texture", LuckyNumberatorHandle)
		
Texture1.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
Texture2.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
Texture1.Face = "Top"
Texture2.Face = "Bottom"

But studio either prints this:

or doesn’t print that at all.

edit

This is basically how my system is setup.

image

1 Like

What’s the NewTextureId? Is the ID directly from the link address?

Yes, the system is set up so the player just puts in an ID like audios for example, and the script will automatically concatenate it with “http://www.roblox.com/asset/?id=” which is the default path for any texture. Even when I put the texture in with studio itself it auto updates to this string with the ID at the end of it… I’m slightly confused on why it isn’t working. Here’s my server script.

ChangeTextureEventPortal.OnServerEvent:Connect(function(Player, TextureNumber)
	local NewTextureId = TextureNumber
	local Character = workspace[Player.Name]
	
	if Player.Backpack:FindFirstChild("Lucky Numberator") then
		local LuckyNumberator = Player.Backpack:FindFirstChild("Lucky Numberator")
		local LuckyNumberatorHandle = LuckyNumberator.Handle
		local TexturesToChange = LuckyNumberatorHandle:GetChildren()

		if LuckyNumberatorHandle:FindFirstChild("Texture") then
			for i, v in pairs(TexturesToChange) do
				if v:IsA("Texture") then
					v:Destroy()
				end
			end
		end

		local Texture1 = Instance.new("Texture", LuckyNumberatorHandle)
		local Texture2 = Instance.new("Texture", LuckyNumberatorHandle)

		Texture1.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
		Texture2.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
		Texture1.Face = "Top"
		Texture2.Face = "Bottom"
		
	else
		-- do nothing
	end

	if Character:FindFirstChild("Lucky Numberator") then
		local LuckyNumberator = Character:FindFirstChild("Lucky Numberator")
		local LuckyNumberatorHandle = LuckyNumberator.Handle
		local TexturesToChange = LuckyNumberatorHandle:GetChildren()
		
		if LuckyNumberatorHandle:FindFirstChild("Texture") then
			for i, v in pairs(TexturesToChange) do
				if v:IsA("Texture") then
					v:Destroy()
				end
			end
		end
		
		local Texture1 = Instance.new("Texture", LuckyNumberatorHandle)
		local Texture2 = Instance.new("Texture", LuckyNumberatorHandle)
		
		Texture1.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
		Texture2.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
		Texture1.Face = "Top"
		Texture2.Face = "Bottom"
	
	else
		-- do nothing
	end
	
end)

Let me know if this works - it’s a sample code, so you’d have to arrange it appropriately, which should be simple, as you’d need to utilise TextureNumber then :LoadAsset():

local ins = game:GetService("InsertService") --obtaining service (Script only)
ChangeTextureEventPortal.OnServerEvent:Connect(function(Player, TextureNumber)
    local textureId = ins:LoadAsset(TextureNumber):GetChildren()[1].Texture
    --now textureId can be used as .Texture
end)

So what I would do is write this variable, textureId to this line of code:

Texture2.Texture = textureId

Right? I’m not very familiar with InsertService, as I found no real need for it up until now

That’s correct - textureId is achieved from .Texture of the created Decal in a Model.

If you’d :LoadAsset(), it’d be like:
Model - we :GetChildren()[1] for the Decal, the child,
Decal - we achieve .Texture from here.

1 Like

Alright! Thank you! I hope this solves my issue and the OP, @Meat_Make 's problem as well.

Hey, I’m running into a minor error when players try to use their own textures, it seems to just fail, and say it’s not trusted. Afterwards, it just temp read errors.

Any ideas? Other games have pulled this off, and even Adonis Donation Commands have with particles and capes as well

The thing only works with Decals that I’ve uploaded, but the goal is to allow any decal to be used on the characters phone

sorry for another edit

I’m on the right, and my friend is on the left.

I used my own texture, and he used his own, but only mine loads in.

That’s awkward - it’s probably the fact that it’s a Decal id. Try to utilise:

I’m a little confused on how I would incorporate this, and what difference does it make with the way I’m doing it? This just seems to be retrieving product information…

Alright - I figured out that it won’t work unless if the inputted ID is created by you, therefore, throwing an HTTP 403 error. I don’t presume it’s possible to achieve another Decal from the library with this method.

Instead, you could try:

1 Like

I’m probably just going to give up on this. I might just make unlockable skins, and have them uploaded myself. Thanks for the help though!