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)
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”
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
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)
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)