before i give the script, please dont criticize me as i am new to scripting, thnx for understanding.
--this is the script i am having problem with. --also please dont criticize the creative strings local CreateNewPart = Instance.new("Part", workspace) function CreatingParts(name, position) CreateNewPart.Position = position CreateNewPart.Name = name print("Done") end CreatingParts("Help", Vector3.new(1,0,0)) CreatingParts("LOL", Vector3.new(2,0,0)) CreatingParts("IHML", Vector3.new(3,0,0)) CreatingParts("HMM", Vector3.new(4,0,0)) CreatingParts("meow", Vector3.new(5,0,0)) CreatingParts("Bomb", Vector3.new(6,0,0)) CreatingParts("Solid", Vector3.new(7,0,0)) CreatingParts("IDKWHATNAMEISHOULDGIVE", Vector3.new(8,0,0)) CreatingParts("IDK2", Vector3.new(9,0,0)) CreatingParts("IDK3", Vector3.new(10,0,0))
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:
function CreatingParts(name, position) local CreateNewPart = Instance.new("Part", workspace) CreateNewPart.Anchored = true CreateNewPart.Position = position CreateNewPart.Name = name print("Done") end CreatingParts("Help", Vector3.new(1,0,0)) CreatingParts("LOL", Vector3.new(2,0,0)) CreatingParts("IHML", Vector3.new(3,0,0)) CreatingParts("HMM", Vector3.new(4,0,0)) CreatingParts("meow", Vector3.new(5,0,0)) CreatingParts("Bomb", Vector3.new(6,0,0)) CreatingParts("Solid", Vector3.new(7,0,0)) CreatingParts("IDKWHATNAMEISHOULDGIVE", Vector3.new(8,0,0)) CreatingParts("IDK2", Vector3.new(9,0,0)) CreatingParts("IDK3", Vector3.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.