Hello, so I have searched and searched, and I can’t find anything useful to me related to this. So, I’m looking for a script that can make objects randomly spawn underground (like in a part’s area)
Could you give an example of what objects you would like to randomly spawn?
Yes, they are all either a part, union, or a mesh (1 instance, except for the mesh objects in a part)
Edit: and a proximity prompt and a script
I’m gonna make the code right now, I will be right back with a working script or a model link…
Alright, thanks!
This text will be hidden
Btw, do you want the objects above the map?
No, they are spawning about 2 studs underground
so they’re spawning below the map?
Correct
This text will be hidden
May I ask why you need a proximity prompt to spawn?
Well, the player is supposed to be able to pick up the objects
ahhh… i see, so you want me to weld the parts to their character after they’ve interacted with the objects?
All I really need is just to make them spawn randomly, nothing else
also, can you include a rarity system?
I thought you wanted to make an item spawn randomly so why are you including a rarity system?
There’s going to be multiple items, can you include multiple items at once?
So when the objects spawn, what do you want to do?
They just anchor and stay there
this code will spawn a random object every 5 secs under the BasePlate
local YourItemsFolder = game.ServerStorage.YourFolder
while wait(5) do
local RandomObject = YourItemsFolder:GetChildren()[math.random(1,#YourItemsFolder:GetChildren())]:Clone()
RandomObject.Position = Vector3.new(math.random(-1022,1022),-18.54,math.random(-1022.96,1022.96))
RandomObject.Parent = workspace
end
ok, i got a working code on that, brb