How to get a decal's image id

So i’m working on a projector gamepass which allows a player with the pass to display a decal on the wall, however, it doesn’t work. I get this error:


The id is correct, the decal is a screenshot of wii sports.
Here is the script:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr, text) local hasPass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.userId, 11189002) if hasPass == true then if workspace.Projector.DecalPart:FindFirstChildOfClass("Decal") then workspace.Projector.DecalPart:FindFirstChildOfClass("Decal"):Destroy() end Instance.new("Decal",workspace.Projector.DecalPart).Texture = "http://www.roblox.com/asset/?id="..text workspace.Projector.DecalPart:FindFirstChildOfClass("Decal").Transparency = 0.2 script.Parent.Parent.Parent.Parent.Enabled = false end

I’m using this with a text box, that’s what the “,.text” is

3 Likes

Right click the decal you want then click id

That isn’t what i’m looking for.

1 Like

try:script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr, text) local hasPass = game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(plr.userId, 11189002) if hasPass == true then if workspace.Projector.DecalPart:FindFirstChildOfClass(“Decal”) then workspace.Projector.DecalPart:FindFirstChildOfClass(“Decal”):Destroy() end Instance.new(“Decal”,workspace.Projector.DecalPart).Texture = 523523523 --id here workspace.Projector.DecalPart:FindFirstChildOfClass(“Decal”).Transparency = 0.2 script.Parent.Parent.Parent.Parent.Enabled = false end end)
–Just try use numbers of id to Texture

Doesn’t work, I can already tell. I’m using this with a text box.

2 Likes

just get this id and transfer to number. Like text = tonumber(text)

I’m not sure you understand, I’m looking to figure out why it isn’t loading correctly, not how to do it, I already know.

1 Like

Decal.Texture = “rbxassetid://“.. Text

That’s what i’ve been doing already

2 Likes

In the original you used:
http://www.roblox.com/asset/?id=

Those aren’t the same, only rbxassetid:// will work from my experience.

Same problem though, it doesn’t load the decal, but I have noticed when I paste it in studio and not while playtesting, it changes the id and loads correctly.

2 Likes

Have you checked if when you paste it into studio, does it change the last few digits of the ID? Sometimes the actual image ID is different from the URL ID.

Yeah, that’s exactly what happens when I do that.

2 Likes

A script wouldn’t automatically change the URL ID into the image ID, so maybe try inputting the changed ID that you get from the actual image in studio into the script if you haven’t already.

That works, however, I want users to just be able to paste the decal id and have it automatically converted, is there any way to do that?

2 Likes

I’ve seen it before done on other dev forum posts but it isn’t easy to do, I’d suggest just a image preview GUI or something so they can manually change the number until it displays correctly. If you wanna go for the other complex way you may wanna search the forum some more.

I’ll search the forum some more, do you by any chance have the link to the forum you looked at?

2 Likes

I’ll check but I’m not sure I’ll be able to find it.

Okay, let me know if you have found it.

2 Likes

Tho they don’t provide code samples, this post explains it all. I’m on mobile currently so I can’t really help with samples.