Decal won't change

I was coding this script and when I tested it out, the TV screen went blank. What happened?

local ClickDetector = script.Parent.ClickDetector
local tele = workspace.television.screen.screentwo.Decal

local function clickd()
	if tele.Texture == 276041093 then
		workspace.television.screen.screentwo.Decal.Texture = 362505168
	else
		tele.Texture = 276041093
	end
end
ClickDetector.MouseClick:Connect(clickd)
1 Like

I think you accidentally pasted an example code block instead of your code, could you edit your post

1 Like

You need to have “rbxassetid://” before the id. So concatenate rbxassetid:// with the texture id or just set the texture id to a string like “rbxassetid://12345678”

So this(example):

tele.Texture = “rbxassetid://12345678”

1 Like

Theres one issue with this.
When trying to change an ID via code, it’ll be very exact on what it pastes as the ID.
On its own “276041093” won’t be enough, you’d need the full link, for example

local ID = “276041093”

https://www.roblox.com/library/"..ID.."/

or

local ID = “276041093”
“rbxassetid:// …ID”

1 Like

Using the logic that you need rbxassetid:// before any id, here is your script but it should work:

local ClickDetector = script.Parent.ClickDetector

local tele = workspace.television.screen.screentwo.Decal

local function clickd()

if tele.Texture == "rbxassetid://276041093" then

workspace.television.screen.screentwo.Decal.Texture = "rbxassetid://362505168"

else

tele.Texture = "rbxassetid://276041093"

end

end

ClickDetector.MouseClick:Connect(clickd)

I think something like this would work

local ClickDetector = script.Parent.ClickDetector
local tele = workspace.television.screen.screentwo.Decal

local mainDecal = tele.Texture
local change = "rbxassetid://362505168"

local deb = false

local function clickd()
	tele.Texture = deb and mainDecal or change
	deb = not deb
end

ClickDetector.MouseClick:Connect(clickd)

Can you try Decal.Texture - "rbxassetid://362505168"

Yeah something like what you said