How do i randomly spawn a part at certain coordinates?

Hey developers!

How would i teleport a part to 1 set of coordinates, for example there is a list of coordinates and it picks one and puts the part there?

Thanks!

local coordsArray = {Vector3.new(xCoord, yCoord, zCoord), Vector3.new(xCoord, yCoord, zCoord)}
local randNum = math.random(1, #coordsArray)
game.Workspace.Part.Position = coordsArray[randNum]
1 Like

Thanks, this works. Thankyou for all your help today.