I keep getting the attempt to call a number value error. The error only occurs when I try to run the function more than once. Any help is appreciated!
for i, v in pairs(allHalos)do
local clone = template:Clone()
clone.Name = v.Name
clone.ImageLabel.ImageColor3 = v.Color
if checkRequirement(v.Name) then
clone.Status.Text = "Unlocked"
else
clone.Status.Text = "Locked"
end
clone.Title.Text = v.Name
clone.Position = UDim2.new(.05 + ((i-1)%2)*.45,0, .025+ math.floor((i-1)/2)*.225,0)
clone.TextButton.MouseButton1Down:Connect(function()
selectedHalo(i) -- error is here!
end)
clone.Parent = template.Parent
v.ShopView = clone
clone.Visible = true
end