Decals Texture Property Not Changing In Script

I am trying to make a part that allows the player to insert an image id into a textbox after purchasing a dev product which will be put onto a part for the server to see. However, roblox has limitations when it comes to decal ids and image ids. Before you ask me if I’ve tried converting them, I have. The issue is that when the player inserts the image id into the textbox of the GUI, the script is supposed to change the decals texture property. The property for the texture just ends up being set to rbxassetid:// with no id behind it which was the intention, and should be working but I’m still confused why it’s not. Any help is appreciated! Let me know how I can improve my script as well.

Script:

local MarketPlaceService = game:GetService("MarketplaceService")

local Players = game:GetService("Players")

local ProductId = 1278400092

local obj

game.ReplicatedStorage.PurchaseImage.OnServerEvent:Connect(function(player, v)
	obj = v
end)

local function ProcessReceipt(ReceiptInfo)

	local Player = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
	if not Player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end

	if Player then
		Player.PlayerGui.Main.PosterUI.Visible = true
		Player.PlayerGui.Main.PosterUI.Button.MouseButton1Click:Connect(function()
			local id = Player.PlayerGui.Main.PosterUI.TextBox.Text
			obj.Decal.Texture = "rbxassetid://"..tostring(id)
			Player.PlayerGui.Main.PosterUI.Visible = false
		end)
	end

	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketPlaceService.ProcessReceipt = ProcessReceipt
2 Likes

Unfortunately, even though it does change the property, it does not update the actual image. I went around this by instancing a new decal and applying the new texture to that decal.

1 Like

It’s already a string, so ditch the tostring. Then if that doesn’t fix it, do some basic debugging and print id so you can see what it is being set to. It’s likely that since this appears to be a server script, it can’t read player text box input.

Try using http://www.roblox.com/asset/?id= instead of rbxassetid://, most likely that’s the problem.

I’ve tried just about everything, including that. I’ve also looked at a ton of other posts from the past.

I tried both with and without the tostring, thinking that it might help but I was obviously wrong. Do you think if I used a remote event to transfer the id to the server from local?

So did you use the decal and just insert it into the part / object after using it as a workaround?

That could work, would change it for all players I believe.

1 Like

I’ll try all of these really quick and see what happens, I’ll come back soon and let you all know the solution if there is one.

Appreciate you man. I had no clue that you have to get a textboxes text from a local script. Thank you so much, you’re a lifesaver! It works! :smiley:

1 Like

I appreciate you pointing that out as well. Thank you so much!