Make 3 parts drop at once before no more drop

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want it so that only 3 parts can drop from my dropper until being collected before more can be spawned in.

  2. What is the issue? Include screenshots / videos if possible!
    I do not know what to change about my code.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked on here, but nobody has any answers.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local replicatedstorage = game.ReplicatedStorage
local drop = replicatedstorage:WaitForChild("Drop")
local dropper = script.Parent
local droplimit = script.DropLimit.Value
boo = true

task.spawn(function()
	repeat
		
		wait(math.random(1,5))
		print("cloning...")
		local new = drop:Clone()
		new.Parent = dropper
		new.CFrame = dropper.CFrame
		droplimit = droplimit + 1
		if droplimit == 3 then
			boo = false
			print("stopped")
		end
	until not boo
	end)

is this good enough?
btw put this script on your dropper (also add number value in the script)

Create a number_of_dropped variable set to 0.
Make a while loop that runs every time the number_of_dropped <4, and do number_of_dropped += 1 every time it drops.


I have got this error when using your code.

You have to add NumberValue in the script and name it to “DropLimit”. Make sure set it value to 0

as a new variable? or what. can you show this in your code?

How about tomorrow. I have to sleep

I’ll explain later

Aaaallllllright, just add NumberValue on your DropHandler and name it that I said before (Not variable, just click the “+” in the right of your DropHandler and type numbervalue then add it)

It’s 1:33 AM in my country now…

image
It works… it just ended up spawning way more and didnt stop. Nothing in the output.

I’ll make a model tomorrow. Ok?

Edit: @war44malk, it was my bad. I accidently set the value when it needs to stay at 0, thanks for the help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.