I've made a tv (started scripting like yesterday so im just kinda randomly doing stuff) but now I am attempting to have it turn back off when I hit the power button again. I want to get the decals to stop and the Brick color to turn back to green when the power button is pushed again. This is the script:
local ClickDetector = script.Parent.ClickDetector local Brick = script.Parent local OnOff = 1 function onMouseClick() Brick.Color = Color3.fromRGB(255,0,0) while OnOff==1 do script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://69103739" wait(0.5) script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://19851297" wait(0.5) script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://1204430503" wait(0.5) script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://1262446339" wait(0.5) end end ClickDetector.MouseClick:connect(onMouseClick)
hey, I think this should work fine
local ClickDetector = script.Parent.ClickDetector local Brick = script.Parent local OnOff = 1 local db = true function onMouseClick() if db == true then db = false OnOff = 1 Brick.Color = Color3.fromRGB(255,0,0) while OnOff == 1 do script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://69103739" wait(0.5) script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://19851297" wait(0.5) script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://1204430503" wait(0.5) script.Parent.Parent.Screen.Decal.Texture = "rbxassetid://1262446339" wait(0.5) end elseif db == false then OnOff = 0 db = true Brick.Color = Color3.fromRGB(0,255,0) end end ClickDetector.MouseClick:connect(onMouseClick)
IDK about decals tho...