Hello, So title is weird, but i'll try to explain it. I want to make script disabled after 5 parts dropped. Basically script works, because it makes script disabled, but parts still falling. Anyway it's dropper script from my tycoon. I want to make parts drop again after mouse click on the Fix Part. Probably i messed up something.
Here is script:
wait(2)
workspace:WaitForChild("PartStorage")
local count = 0
local FixPart = script.Parent.Fix
while wait(2.5) do
count = count + 1
if count % 5 == 0 then
script.Disabled = true
FixPart.ClickDetector.MaxActivationDistance = 22
FixPart.Sign1.Enabled = true
FixPart.Sign2.Enabled = true
function onClicked (Part)
FixPart.ClickDetector.MaxActivationDistance = 0
FixPart.Sign1.Enabled = false
FixPart.Sign2.Enabled = false
script.Disabled = false
end
FixPart.ClickDetector.MouseClick:connect(onClicked)
else
local part = Instance.new("Part")
part.Parent = game.Workspace.PartStorage
local cash = Instance.new("IntValue",part)
cash.Name = "Cash"
cash.Value = 5
part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1,0)
part.Size = Vector3.new(1, 1, 1)
part.Rotation = Vector3.new(-0,-0,0)
part.TopSurface = "Smooth"
game.Debris:AddItem(part,20)
end
end

3 comments
you'll have to disable it in another script
I thought you can do it in the same script.. Okay, i'll check it out.
Use a for loop.