Basically, I am trying to spawn this part around a specific region on a map. I tried using Vector values to spawn the part but it still does not work. Instead of spawning in between that region, the piece only spawns on the positions. Help Is Appreciated and UpVoted! This is my following code:
local GrassIsCutted = false -- ignore this. its for a different purpose local OriginalPiece = game.ServerStorage.OriginalPart local positionsTable = {Vector3.new(-59.5, 1.5, -23.5), Vector3.new(-59.5, 1.5, 26.5),Vector3.new(-8.23, 1.5, 26.467),Vector3.new(-8.5, 1.5, -23.5)} function duplicatePiece() math.randomseed(tick()) local position = positionsTable[math.random(1,#positionsTable)] local clonedPiece = OriginalPiece:Clone() clonedPiece.Position = position clonedPiece.Parent = game.Workspace end while true do wait(10) duplicatePiece() end
I placed the OriginalPiece in the ServerStorage by the way. Thank you for taking your time to read and debug this. :)
You forgot to set its parent to workspace; you won't see it in your game if you don't do this. So simply do
clonedPiece.Parent = workspace
right after you clone it and you should see it in your game.