function PartGenerator(Name, Color, Material, Position)
local Part = Instance.new("Part")
Part.Name = Name
Part.Parent = workspace
Part.BrickColor = Color
Part.Material = Material
Part.Position = position
Part.Reflectance = 1
Part.Anchored = true
Part.CanCollide = true
end
PartGenerator(Part1, BrickColor.new("Really red"),Enum.Material.Asphalt, Vector3.new(0,15,0))
PartGenerator(Part2, BrickColor.new("Really blue"), Enum.Material.CrackedLava, Vector3.new(0,20,0))
COMMUNITY QUESTION
I made a script to generate 2 parts, but its just not working. Any idea where I went wrong?
1 answer
Hey there! I think you might have forgotten to make the name a string.
Line 13:
PartGenerator("Part1", BrickColor.new("Really red"),Enum.Material.Asphalt, Vector3.new(0,15,0))
Line 14:
PartGenerator("Part2", BrickColor.new("Really blue"), Enum.Material.CrackedLava, Vector3.new(0,20,0))
If this still doesn't work, please comment what errors the output is printing. :D
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
you don't seem to be giving a string for the name parameter
Use a string. Also do Part.Position = Position instead of position.