There are two problems I can see with this.
The first, as mentioned by kkfilms_1 is that the variable is outside of the function. This means that it simply calls every part as the same thing, simply renaming and moving.
The second, which I think is why you only had 4 left, is that they were unanchored. As they collide with other parts, specifically the others made, they will get large velocities, fly off the map, and be despawned. Anchoring should solve that solution.
With both of these implementations, your code should you something like this:
01 | function CreatingParts(name, position) |
02 | local CreateNewPart = Instance.new( "Part" , workspace) |
03 | CreateNewPart.Anchored = true |
04 | CreateNewPart.Position = position |
05 | CreateNewPart.Name = name |
10 | CreatingParts( "Help" , Vector 3. new( 1 , 0 , 0 )) |
11 | CreatingParts( "LOL" , Vector 3. new( 2 , 0 , 0 )) |
12 | CreatingParts( "IHML" , Vector 3. new( 3 , 0 , 0 )) |
13 | CreatingParts( "HMM" , Vector 3. new( 4 , 0 , 0 )) |
14 | CreatingParts( "meow" , Vector 3. new( 5 , 0 , 0 )) |
15 | CreatingParts( "Bomb" , Vector 3. new( 6 , 0 , 0 )) |
16 | CreatingParts( "Solid" , Vector 3. new( 7 , 0 , 0 )) |
17 | CreatingParts( "IDKWHATNAMEISHOULDGIVE" , Vector 3. new( 8 , 0 , 0 )) |
18 | CreatingParts( "IDK2" , Vector 3. new( 9 , 0 , 0 )) |
19 | CreatingParts( "IDK3" , Vector 3. new( 10 , 0 , 0 )) |
I tested it for myself, and it worked as far as I saw. If you have any further problems, please do reply.
Hope this helped.