I am assuming you know how to use Roblox Studio properly, so if you don't know how to do something, please ask me
To make a part spawn randomly, you will need to put a
Name the script whatever you like, then type a code similar to this in there:
function randomSpawn() while wait(1) do -- every 1 second a block that spawns at random in the Workspace local pos1 = math.random(-200, 200) local pos2 = math.random(-200, 200) --//experiment with where it spawns, -200,200 means it spawns in a random position between -200 and 200 on an axis of your choosing at one.Position local one = Instance.new("Part", game.Workspace) one.Name = "NewPart" -- your part name one.Anchored = false -- keep false if you want it to fall to the ground, you can do "wait(2); one.Anchored = true" if you would like it to be anchored after it hits the ground one.Size = Vector3.new(4,4,4) -- you pick the part size here one.Material = Enum.Material.SmoothPlastic -- replace SmoothPlastic with your material of choice one.Position = Vector3.new(pos1, 30, pos2) -- choose how high you want it to start at on the Y Axis (up and down, where it says "30") end end randomSpawn()
Once you copy and pa- I mean.. type this script, click Play in Roblox Studio, then wait 1 second. They will start spawning at random around your game!
This works with FilteringEnabled On, if you were wondering. If something doesn't work, please ask how to fix it, and what isn't working about it.
Sorry if this was a short tutorial, just wanted to help anyone if they were trying to make something similar to this. I use it in my coming soon game, Box Collecting Simulator. It has the word Simulator in it, so it MUST be good, right?
(Game will be on my alternate account, JellyDevelops, sorry for advertising if it is against the rules.)