So i want to clone an object from ServerStorage and it does do that but i clone's two of the same object and i just want it to copy one of that selected object.

Script:

function SpawnBoxes(tab)
	for _,v in pairs(tab) do
		local BoxOfChoise = v.Box.Value
		game.ServerStorage.Boxes:FindFirstChild(BoxOfChoise):Clone().Parent = v.Character
	end
end
	
script.SpawnBoxes.Event:connect(function(tab) 
	SpawnBoxes(tab) 	
end)

3 comments

0

Check if the object is there prior to cloning?

0

Under line 3 add - If v.Character:findFirstChild(BoxOfChoise) == nil then - and put the "end" after the clone part :)

0

Thank you