I am trying to make bandits spawn at certain positions in the Workspace and it is currently not working, there is a problem on line 7, in which the output says:
21:31:42.834 - Workspace.Script:22: attempt to call a table value
I also believe line 13 may result in an error but I am not sure because I haven't got that far through without it breaking, there are 3 parts in the Workspace called Spawn_Postion1, Spawn_Postion2 and Spawn_Position3
This is a normal script in the Workspace
Colours = {BrickColor.new("Insitutional white"), BrickColor.new("Pastel yellow"), BrickColor.new("Sand red")}
function Bandits()
for i = 1, 3 do
Bandit = game.Lighting.Bandit:Clone()
Bandit.Name = "Bandit"..i
for i in (Bandit:GetChildren()) do
Choice = math.random(1, 3)
if i.Name == "Left_Arm" or i.Name == "Right Arm" or i.Name == "Head" then
i.BrickColor = Colours[Choice]
end
end
Bandit.Torso.Position = game.Workspace[("Spawn_Position"..i)].Position
end
end
Thank you in advance

4 comments
Line 13 is fine. The output says line 22. Post the rest.
Post the rest of the code; We DO NOT know what Line 22 is! Please post the full script so we can have a better understanding of the problem.
There is no rest of code, that is all the code, when I start a new script I write each line(ish) out in commented psuedocode that is all the actual code, but I can twll you line 7 above is line 22 in the wcript
You are getting this error because it is trying to call the table as an iterator function.