Why do my dropper won't drop the wood when I click on the button?

Hi!

My friend, @kingfarhaan123 made a dropper system and asked me to make it so when a player click on the button, the part that we did drop out of the dropper. But it’s did not work.

SS:

Help. It’s still don’t work. Anyone can help me with it?

Hey, in the future, if you ever make a post asking for scripting help like this, be sure to post the script formatted this way so that it’s easier to test out the code and see what exactly is wrong.

The code might be irrelevant though. Seems that the main issue is simply that the script is a LocalScript. Change it to a normal script.

What’s the error? and also it looks like you are referring to a Dropper inside the “game” Instance (Unless the script’s parent part is inside something) And you are also using a local script instead of a script.

Another big issue to go along with this. By having a while true do loop within the click function, the part will be added constantly and endlessly every 5 seconds, and the rate will increase for every click you do. I would recommend this code instead:

local debounce = false    

script.Parent.ClickDetector.MouseClick:Connect(function()
    	if debounce == false then
    		debounce = true
    		fire()
    		wait(5)
    		debounce = false
    	end
    end)

By adding a debounce, you limit the player to one click per 5 seconds (in this case, the wait time). Furthermore, there is no loop, meaning you won’t have the issue of the click detector spamming too many replicated parts.

Try to use a Script not a Local Script

1 Like