function makeBrick() Block = Instance.new("Part") Block.Name = "RoundBlock" Block.Shape = "Ball" Block.Size = Vector3.new(4,4,4) Block.Position = Part.Position + 4 Block.BrickColor = BrickColor.new("Bright red") Block.Parent = game.Workspace end while true do wait(10) makeBrick() end
--the brick doesn't spawn
On line 6 of that code block, you are trying to access Part.Position
, which doesn't exist in that context.
Remove the reference, or make sure that Part
is a valid reference to a BasePart Instance.
Like what adark said, Part does not exist, you must use the instance you created which is Block.
Also, you have to use Vector3 and add two Vector3's together. The end result is this.
function makeBrick() Block = Instance.new("Part") Block.Name = "RoundBlock" Block.Shape = "Ball" Block.Size = Vector3.new(4,4,4) Block.Position = Vector3.new(Block.Position.X, Block.Position.Y, Block.Position.Z) + Vector3.new(0, 4, 0) Block.BrickColor = BrickColor.new("Bright red") Block.Parent = game.Workspace end while true do wait(10) makeBrick() end