How can I get the texture URL of a decal?

Hello,

I am currently trying to find a way to get the URL of a texture of a decal. Basically I need to get the texture of the decal of someone face.

I have tried to do Head.face.Texture however this seems not to work and when I try to save this inside of a string value it errors saying that it’s not a string but rather an instance which makes no sense cuz I can see the Texture in the properties section.

image

Also what I am confused about is it claims when I try to add the URL to a string value it claims it’s an instance even though when I try to get any Properties of this Instance it claims to be it says that it’s a string. I really don’t understand why this is doing this.

Error I get when trying to get a property which claims it’s a string:
image image

Error I get when I try to add the string to a string value claiming it’s an instance:

image

Code:

Events.SpawnSelection.OnServerEvent:Connect(function(plr, ShirtDetails, PantsDetails, FullName, Face)
	if plr then
		print(Face)
		plr.Character.Shirt.ShirtTemplate = ShirtDetails
		plr.Character.Pants.PantsTemplate = PantsDetails
		plr.Character.Head.face.Texture = Face
		local SelectionFolder = plr:FindFirstChild("SelectionArea")
		local Shirt = SelectionFolder:FindFirstChild("Shirt")
		local Pants = SelectionFolder:FindFirstChild("Pants")
		local Face = SelectionFolder:FindFirstChild("Face")
		Shirt.Value = ShirtDetails
		Pants.Value = PantsDetails
		Face.Value = Face
	end
end)

I feel like I am missing something really stupid but I just can’t work out what the issue is cuz I swear it should work fine.

To answer your question, It’s definitely the method you used. Ids normally go about like what you’ve shown, with either an asset link using HTTP or a rbxassetid.
I think the main issue is your code. Do you mind showing the explorer tree for this “SelectionArea”? It’s a little unclear what you’re trying to set the value for.

If you mean the values then sure. It’s basically just a simple character selection system which I want so when the user joins it will give the clothing they choose first without doing the selection again.

Here is where the selection stuff are created:

image

I am unsure why the rest works (the Shirt and Pants) only the Face seems to not work like the Shirt and Pants do.

Huh - I don’t really see much of an issue then. In theory, this should work. What line of code is this script erroring at specifically, or is that the entirety of the code being shown?

I’ll try recreating what you’re doing to see if this happens to me while we try to figure this out.

Yea that is why I am super confused on what I am doing incorrectly.

It’s saying as shown in the above error message line 18 where I try save the face URL inside of the string value.

Here is the line it is doing the error at:

image

Line 18?
Are you sure? Your screenshots mentioned that it broke at Line 8.
Did you just add extra code since then?

Edit: Realised my error. You’re printing something. My mistake

It does not say Line 8. If you look it says line 18 the error is at. I think your confusing the error message with the print.

This is the front end where I send the request to the server if that is any help, it just gets the Texture though from the face decal:

image

I’ve managed to replicate your error. That’s extremely odd…

Ideally, it should change the value. I’ll look into it further.

Okay, I found the issue.
You have conflicting values.
Basically, You called the string for the event “Face”. You’re also calling the StringValue “Face”. They overwrite each other. See the issue?
Try renaming “Face” to something else, like this:

game.ReplicatedStorage.SomeEvent.OnServerEvent:Connect(function(plr, ShirtDetails, PantsDetails, FullName, Face)
	if plr then
		print(Face)
		plr.Character.Shirt.ShirtTemplate = ShirtDetails
		plr.Character.Pants.PantsTemplate = PantsDetails
		plr.Character.Head.face.Texture = Face
		local SelectionFolder = plr:FindFirstChild("SelectionArea")
		local Shirt = SelectionFolder:FindFirstChild("Shirt")
		local Pants = SelectionFolder:FindFirstChild("Pants")
		local Face_Value = SelectionFolder:FindFirstChild("Face")
		Shirt.Value = ShirtDetails
		Pants.Value = PantsDetails
		Face_Value.Value = Face
	end
end)

That should be your solution!

So yes, it was something stupidly small. lol

1 Like

Ah shoot I forgot about the value called Face. Kinda an embarrassing as I have been coding for about 2 years on Roblox and I got stuck on that stupid mistake. :man_facepalming: I just completely missed that I put the Face as the value of the string value as well.

Thanks for the help.

No problem! We all have them moments.