I want to make it so every 2 rounds, 1 more plate dissapears and for some reason it breaks after the first time:
for i = 1, script.Parent.Difficulty.Value do
local randomint = math.random(1, 4)
local selected = colors[randomint]
selected.Transparency = 1 -- Line 78 where the error fires
selected.CanCollide = false
table.remove(colors, randomint)
randomint = nil
selected = nil
end
We should know what does the ‘colors’ table contains in order to resolve the issue. Also tell us what type of Instance is picked from table (Part, Model, Value etc.).
for i = 1, script.Parent.Difficulty.Value do
local randomint = math.random(1, 4)
local selected = colors:GetChildren()[randomint]
selected.Transparency = 1 -- Line 78 where the error fires
selected.CanCollide = false
table.remove(colors, randomint)
randomint = nil
selected = nil
end