Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I made a script to generate 2 parts, but its just not working. Any idea where I went wrong?

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))
	

2 comments

2

you don't seem to be giving a string for the name parameter

1

Use a string. Also do Part.Position = Position instead of position.

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.