Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Parts were cloned too many times?

I have problem with cloning beacuse when script is executing it clones 3 or 2 block's in same place more than it's schould


	

	
        while true do
	local x = math.random(0,3)
	local pos = script.Parent.PositionOfBlocks.Value
	script.Parent.PositionOfBlocks.Value = script.Parent.PositionOfBlocks.Value + 4
	if x <= 2.8 then
		local grass = game.ReplicatedFirst.Generate.BlockOfGrass:Clone()
		grass.Parent = game.Workspace
		grass.Position = script.Parent.Position + Vector3.new(pos,0,0)
		
	
	
	else
			local coal = game.ReplicatedFirst.Generate.BlockOfStone:Clone()
		coal.Parent = game.Workspace
		coal.Position = script.Parent.Position + Vector3.new(pos,0,0)
		
	end
	if (script.Parent.Name == "BasicBlock")then
	 local clone = script.Parent:Clone()> 
	 clone.Parent = game.Workspace
	 clone.Position = script.Parent.Position + Vector3.new(0,0,pos)
	 clone.PositionOfBlocks.Value = 0 
	 clone.Name = ("ClonedCloner")
	 end
	
	 wait()
         end

No Errors :

1 answer

Instead of While true do use for i = 1,HowManyTimes do. Use below and copy and paste your above script.

for i = 1,10 do --This will repeat 10 times
wait()
--Put the code you want here to do it that many times.
end

This discussion is preserved as it was. New answers, comments, and votes are closed.