Decal texture not changing

I’m making a system where the user can get an image from roblox, insert the link into a text box, then a decals texture ingame will change to that image. For some reason it’s not working, or erroring, here’s the code:

Server:
local repStor = game:GetService("ReplicatedStorage")

local changeBoothInfo = repStor:WaitForChild("ChangeBoothInfo")

local booths = workspace:WaitForChild("Booths")
local players = game:GetService("Players")

local TextService = game:GetService("TextService")
local filteredText

changeBoothInfo.OnServerEvent:Connect(function(player, textType, inputText)
	local success, err = pcall(function()
		local filtered = TextService:FilterStringAsync(inputText, player.UserId)
		filteredText = filtered:GetNonChatStringForBroadcastAsync()
	end)
	if textType == "BoothText" then
		for _, v in pairs(workspace.Booths:GetChildren()) do
			if v.OwnerValue.Value == player.Name then
				v.Text.Gui.Text.Text = filteredText
			end
		end
	elseif textType == "TopImage" then
		for i, v in pairs(workspace.Booths:GetChildren()) do
			if v.OwnerValue.Value == player.Name then
				v.ImageOne.Decal.Texture = inputText
			end
		end
	elseif textType == "SideImage" then
		for i, v in pairs(workspace.Booths:GetChildren()) do
			if v.OwnerValue.Value == player.Name then
				v.DecalTwo.Decal.Texture = inputText
			end
		end
	end
end)
Client:
local player = game:GetService("Players").LocalPlayer
local repStor = game:GetService("ReplicatedStorage")
local playerGui = player:WaitForChild("PlayerGui")

local boothClaimed = repStor:WaitForChild("BoothClaimed")

local openEdit = playerGui:WaitForChild("EditBooth"):WaitForChild("OpenEdit")

local editFrame = playerGui:WaitForChild("EditBooth"):WaitForChild("EditFrame")

local submitBoothTextButton = editFrame:WaitForChild("SubmitBoothText")
local submitSideImageButton  = editFrame:WaitForChild("SubmitSideImage")
local submitTopImageButton  = editFrame:WaitForChild("SubmitTopImage")

local boothTextInput = editFrame:WaitForChild("BoothTextInput")
local topImageID = editFrame:WaitForChild("TopImageID")
local sideImageID = editFrame:WaitForChild("SideImageInput")

boothClaimed.OnClientEvent:Connect(function()
	for i = 1, 20 do
		openEdit.TextTransparency -= 0.05
		openEdit.BackgroundTransparency -= 0.05
		task.wait(0.05)
	end
end)

openEdit.MouseButton1Click:Connect(function()
	playerGui:WaitForChild("EditBooth"):WaitForChild("EditFrame").Visible = not playerGui:WaitForChild("EditBooth"):WaitForChild("EditFrame").Visible
end)

submitBoothTextButton.MouseButton1Click:Connect(function()
	local userInputText = boothTextInput.Text
	repStor.ChangeBoothInfo:FireServer("BoothText", userInputText)
end)

submitSideImageButton.MouseButton1Click:Connect(function()
	local userInputText = sideImageID.Text
	repStor.ChangeBoothInfo:FireServer("SideImage", userInputText)
end)

submitTopImageButton.MouseButton1Click:Connect(function()
	local userInputText = topImageID.Text
	repStor.ChangeBoothInfo:FireServer("TopImage", userInputText)
end)

Put rbxassetid:// before your decal id.

like rbxassetid://1234567890

✔ Correct

v.ImageOne.Decal.Texture = "rbxassetid://"..inputText

❌ Wrong

v.ImageOne.Decal.Texture = inputText
1 Like

Now it just prints in the output: Image https://assetdelivery.roblox.com/v1/asset?id=8454083166 failed to load. Error 403: Asset type does not match requested type

try

v.ImageOne.Decal.Texture = "http://www.roblox.com/asset/?id="..inputText

Or then you are putting the wrong id

I’m definetely putting the ID right, whenever I change the ID manually, it works, but whenever I do it with the script, it changes the ID but I can’t see the image on the decal.

That’s because when you do it manually Roblox autocorrects it for you(you can see it changing when pasting it to decals). Basically the issue is that you try to load an image without using the actual asset id(the asset id isn’t the one on the website). Although there is an endpoint which allows you to load images using the id provided on the website:

image.Texture = "rbxthumb://type=Asset&w=768&h=432&id="..inputText
4 Likes

Thank you, it works. Quick question though, is rbxthumb a third party thing or is it made by roblox

It is something made by Roblox, hence how would we have toolbox?
Also if it was a third party, then it must be a party that Roblox hired in the first place.

1 Like