Is there a way to iterate through instances using the counter in a for loop? Something like this?
The lights are just in counts of 1 like
Light 1
Light 2
And so on. Please help?
Is there a way to iterate through instances using the counter in a for loop? Something like this?
Light 1
Light 2
And so on. Please help?
You would be doing something called:
Where you essentially combine two or more things together to form one item, like this:
local concat = "Hello " .. "Player!" -- Normal Version
local concatAlt = `Hello {"Player!"}` -- Alternate Version
-- The Formats that can be used for .. and {}
print(concat) --> Hello Player!
print(concatAlt) --> Hello Player!
So for our code, we can do this:
for i = 1, 20 do
local Item = `Light{i}` -- concatenated name
workspace.CeilingASM[Item].Glow.SurfaceLight.Enabled = false -- the String is used to look for an Item
task.wait(.5)
end
Thank you so much i knew there was a way to do it i just forgot cause its been a while. Thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.