Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this while statement not doing the correct thing?

Asked by
chasedig1 115
6 years ago

This while statement is doing the incorrect thing, it is giving me no errors, yet says that the children of the object are zero when that is not true. Full code:

--Don't change the name of Cannon, or anything else within the Cannon model, unless you're willing to rewrite the script.
local dispenser = script.Parent
local dispensingPosition = workspace.DoughDispenser.dispenserarea
local Holder = Instance.new("Model", game.Workspace.Containers)
Holder.Name = "DoughHolder"
--Gets the current amount of children (used later in a while statement) in the container.
local currentAmount = #workspace.Containers.DoughHolder:GetChildren()
print (currentAmount)
while game.ServerStorage.DoughValue.Value >= 1 and currentAmount <= 2 do

    game.ServerStorage.DoughValue.Value = game.ServerStorage.DoughValue.Value - 1
local Copy = game.ServerStorage.DoughPart:Clone()
Copy.Parent = game.Workspace.Containers.DoughHolder
Copy.Position = dispensingPosition.Position
Copy.Velocity = Vector3.new(0,0,5)
wait(2)
end



Problematic Code:

and currentAmount <= 2 do

Help?

0
Did line 8 print the correct amount of children? lesliesoon 86 — 6y
0
No. chasedig1 115 — 6y

Answer this question