I am making factory conveyor for a challenge that spawns boxes and sends them down the conveyor belt after you click the on button. How should I spawn boxes?
The on button script:
function onClicked(PlayerWhoClicked) local c = script.Parent.Parent.Conveyer local velocity = 1000 if script.Parent.Size == Vector3.new(1,.6,1) then if c then c.Velocity = Vector3.new(velocity,0,0) script.Parent.Size = Vector3.new(1,.4,1) script.Parent.Position=script.Parent.Position-Vector3.new(0,.2,0) script.Parent.Parent.Off.Size = Vector3.new(1,.6,1) wait() end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
The off button script is pretty much the same.
if I want to spawn bricks should I do something like this: (after line 9)
for I=1, 10000000000000000000000000000000000 do if script.Parent.Size == Vector3.new(1,.4,1) then b = script.Parent.Parent.Box:clone() b.Position=b.Position-Vector3.new(0,2,0) end end
****Now I have a new idea please somebody reply if it works. Should I try using a repeat until thingy so it repeats the part being cloned every 2 seconds until the off button is pressed and the on button is up?