#so im pretty new to Scriping and this is what have For a MultiDrop System

36 messages · Page 1 of 1 (latest)

fair berry
#

and its only Spawning from 1 location

local Table = {}
local Values = script.Parent:FindFirstChild('Values')
local DropperFolder = script.Parent:FindFirstChild('DropperParts')
local MainItems = script.Parent:FindFirstChild('MainItems')
local BoughtItems = script.Parent:FindFirstChild('BoughtItems')
local Buttons = script.Parent:FindFirstChild('Buttons')
local Lava = MainItems.CashCollection.Lava
local CashValues = Values.CashValue
function OnSpawn()
    local parts = script.Parent.DropperParts:GetChildren()
    for _, part in pairs(parts) do
        if part:IsA("BasePart") then
            part.Touched:Connect(function(hit)
                if hit == Lava then
                    local cash = part:FindFirstChild("CashValue")
                    if cash then
                        CashValues.Value = CashValues.Value + cash.Value
                    end
                    part:Destroy()
                end
            end)
        end
    end
end
function Table:DropParts(CashValue)
    for _, model in pairs(BoughtItems:GetChildren()) do
        if model:IsA('Model') and (model.Name == "Dropper" or model.Name == "Dropper1") then
            local Pos = model:FindFirstChild("Pos")
            if Pos then
                local Siz = Pos.Size
                while true do
                    task.wait(2)
                    local newPart = Instance.new('Part',DropperFolder)
                    newPart.Position = Pos.Position
                    newPart.Size = Siz
                    local Cash = Instance.new('NumberValue',newPart)
                    Cash.Name = 'CashValue'
                    Cash.Value = CashValue
                end
            end
        end
    end
end
Lava.Touched:Connect(OnSpawn)
return Table``` this is the Module that i did to Drop Parts if Bought Items is true
#

then this is the MainScript

local Drop = require(script.Parent.DropperModuleScript)
for _, model in pairs(BoughtItems:GetChildren()) do
    if model:IsA('Model') then
        if model.Name == 'Dropper' then
            Drop:DropParts(1)
        elseif model.Name == 'Dropper1' then
            Drop:DropParts(5)
        end
    end
end```
#

the NewParts Spawning gets spawned on Dropper and not on Dropper1

#

they are the Same but named Differently

candid current
#

Your while loop is holding up the script on the first Dropper it hits between Dropper1 and Dropper2.

#

Perhaps surround your call to DropParts with the while loop instead.

#

Basically drop the while loop in your module script's code and add it to your main script surrounding the for loop

fair berry
#

so basically remove the while loop in the Module

candid current
#

Basically yes

fair berry
#

then lua -- so where to put the loop then local Drop = require(script.Parent.DropperModuleScript) for _, model in pairs(BoughtItems:GetChildren()) do if model:IsA('Model') then if model.Name == 'Dropper' then Drop:DropParts(1) elseif model.Name == 'Dropper1' then Drop:DropParts(5) end end end

candid current
#

Maybe do your main like this:

local Drop = require(script.Parent.DropperModuleScript)
while true do
  for _, model in pairs(BoughtItems:GetChildren()) do
    if model:IsA('Model') then
        if model.Name == 'Dropper' then
            Drop:DropParts(1)
        elseif model.Name == 'Dropper1' then
            Drop:DropParts(5)
        end
    end
  end
end

idk I'm just freestyling

fair berry
#

ye i just started yesterday

candid current
#

You're working with some moderately advanced stuff already, noice.

fair berry
#

so what about the task.wait(2) under that```lua
while true do

candid current
#

ohfrick yeah

#

do that

#

Or it'll crash lmao

fair berry
#

well i did create a BigNum but in 9 lines techinally

#

ok thx for the part now i can make a Game Dropper game that is Based on 1 script but loops on the Same time

candid current
#

Oh it works properly now?

#

If so please tag this post "Solved"

fair berry
sullen zephyrBOT
#

studio** You are now Level 1! **studio

candid current
#

I have no idea what you're referencing, but I am excited for your excitement.

fair berry
candid current
#

You're speaking fundamental compsci at me and it's missing every time.

fair berry
#

so u know if i have 1000 cash my Module will convert that 1000 then divide by 1000 then add a suffix

candid current
#

Oh, I see what you mean now. I recognize the concept, but I didn't recognize the name of it I suppose. Always wondered what people called them. It sounds like you've made a very succinct solution to a common issue. Congratulations 🙂

candid current
#

I expected you had some experience with other languages. Please mark the post "Solved" if the issue has been resolved. 🙂

fair berry
#

i did is it the Green Thumb

candid current
#

No, it's a tag the ones you assign- you got it

fair berry
#

oh i found it and thx for the help

candid current
#

Any time I'm bored, available, and on here.

fair berry
#

took me like 2 hrs on why its not working until u told me what to do

candid current
#

You'll get the experience with the language eventually.