Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Trying to simply make a tv switching decals. Help?

script:

local button = script.Parent
local tv = script.Parent.Parent.Screen
local hd = tv.HomeDepot
local mp = tv.MPMotors
local Kim = tv.Kimbo
local Xiv = tv.Xivics
 
local advertisements = {hd, mp, Kim, Xiv}

function television(onClick)	
while true do 
for i,v in pairs do
		
	end
end

This script belongs to the button that turns it on and there's another that turns it off. I just don't know how to plug the table into the for loop. Help?

1 answer

✓ Accepted answer
local button = script.Parent
local tv = script.Parent.Parent.Screen
local hd = tv.HomeDepot
local mp = tv.MPMotors
local Kim = tv.Kimbo
local Xiv = tv.Xivics

local advertisements = {hd, mp, Kim, Xiv}
local timeswitch = .5
function television(onClick)    
breaker = Instance.new("BoolValue")
breaker.Name = "Breaker"
breaker.Parent = tv
while true do 
wait()
for i,v in pairs(advertisements) do
v.Transparency = 0
wait(timeswitch)
v.Transparency = 1
    end
if breaker == nil then
break
end
end

You need to reference the table advertisements and so v would be the iterating correlating table number so that would be the decal in the table it's on atm so then just reference it with v! accept and +1 plox im nub if it works

This discussion is preserved as it was. New answers, comments, and votes are closed.