What I'm trying to do is have a new part positioned onto the position of an existing part from a folder located in workspace called container, all the parts inside of the folder are called "SP".

It works fine however when it sets the position of the new parts it does it in a sequence, I want it to choose a random "SP" and position it to that instead of having it do it in a particular sequence.

TL;DR**

How do I set the position of a new part to a random one in a folder, and make it as random as possible each time? **

This is what I have so far.


while wait(1.5) do
	local spawnlocation = game.Workspace.Container:GetChildren()
	
	for _,x in pairs(spawnlocation) do
		if x.Name == "SP" then
			
			
			local test = Instance.new("Part")
			test.Parent = game.Workspace
			test.Position = x.Position
			test.Color = Color3.fromRGB(math.random(1,255),math.random(1,255),math.random(1,255))
		end
	end
end


1 comment

0

wait() should NOT be a condition.