Hello,
Im trying to clone stages and put them one behind another, but in the 2nd loop im getting the error above.
I am 97.5% sure this part is the problem, but idk why.
for s = 1, #Stages do
Stages[i].Name = "Stage"..s
end
Full code here:
local function LoadStages()
for i = 1, 10 do
local Stages = ReplicatedStorage:FindFirstChild("Stages"):GetChildren()
local stage = math.random(1, #Stages)
--line 49 under here
ReplicatedStorage:FindFirstChild("Stages"):FindFirstChild("Stage"..stage).Parent = ReplicatedStorage:FindFirstChild("InUse")
local stageClone = ReplicatedStorage:FindFirstChild("InUse"):FindFirstChild("Stage"..stage):Clone()
stageClone.Parent = CurrentStages
stageClone.Primary.Position = Vector3.new(733.5, 3.5, 380 + (910 * (i-1)))
UpdateColors(stageClone)
for s = 1, #Stages do
Stages[i].Name = "Stage"..s
end
end
end
I only got 2 stages but it still should work for these 2.
After the first loop the stage, that is left in the Stages folder gets renamed to Stage 2, no matter if i do
for s = 1, #Stages do
Stages[i].Name = "Stage"..s
end
or
for s = 1, #Stages do
Stages[i].Name = "Stage"..(s-1)
end