so i have this value and everytime it changes with +1 i need it to copy a frame and change its position(and name) but i don't know how i would do this without scripting it with every value
i tried doing it with a loop but then when i come to the third copy the item would have the same position as the second one
the script:
hmi.Changed:connect(function() if hmi == 1 then scroller.Item1.Visible = true end if hmi == 2 then -- is there a way to automate this with a loop or something? local item = scroller.Item1:copy() item.Position = UDim2.new(0, 0,0.002, 0) item.Name = 'item2' end end)
You could use a for loop, like this :
for i = 1,10 do if hmi = i then --put what it does here end end
Here, "i" will be 1 then 2, then 3, etc... By doing this, u dont have to write every single value but, if u want to make a different thing for each value, you'll need to write it for every value. So, if it always does the same thing, just the this loop