|
| 18 Aug 2016 10:19 AM |
--Item spawning script by TheHolyEpicPenguin
--The Item(s) beans = game.ReplicatedStorage.Beans --The first model you want to spawn backup1 = beans:clone() sprite = game.ReplicatedStorage.Sprite --The second model you want to spawn backup2 = sprite:clone() --Spawn location spawner = game.Workspace.BeanSpawn --The spawn location --Configuration config = script.Parent.Config --The configuration folder Lreload = config.minreload.Value --Minimun reload time Mreload = config.maxreload.Value --Maximum reload time
while true do wait(.25) local modelcorrect = math.random(1,2) if modelcorrect == 1 then local reload = math.random(Lreload, Mreload) model1 = beans:clone() model1.Name = "Bean1" model1.Parent = game.Workspace model1.Handle.CFrame = CFrame.new(spawner.Position) wait(reload) end else if modelcorrect == 2 then local reload = math.random(Lreload, Mreload) model2 = sprite:clone() model2.Name = "Sprite1" model2.Parent = game.Workspace model2.Handle.CFrame = CFrame.new(spawner.Position) wait(reload) end
for the "else", it says "expected 'end' (to close 'do' at line 15), got 'else' I want to make it so that if the math.random picks 2, then the Sprite will spawn |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 10:22 AM |
| boy u r literally missing an end for the while true do function |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 10:23 AM |
beans = game.ReplicatedStorage.Beans --The first model you want to spawn backup1 = beans:clone() sprite = game.ReplicatedStorage.Sprite --The second model you want to spawn backup2 = sprite:clone() --Spawn location spawner = game.Workspace.BeanSpawn --The spawn location --Configuration config = script.Parent.Config --The configuration folder Lreload = config.minreload.Value --Minimun reload time Mreload = config.maxreload.Value --Maximum reload time
while true do wait(.25) local modelcorrect = math.random(1,2) if modelcorrect == 1 then local reload = math.random(Lreload, Mreload) model1 = beans:clone() model1.Name = "Bean1" model1.Parent = game.Workspace model1.Handle.CFrame = CFrame.new(spawner.Position) wait(reload) end else if modelcorrect == 2 then local reload = math.random(Lreload, Mreload) model2 = sprite:clone() model2.Name = "Sprite1" model2.Parent = game.Workspace model2.Handle.CFrame = CFrame.new(spawner.Position) wait(reload) end end fixed version |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 10:29 AM |
^ NOT fixed
for the "else", it says "expected 'end' (to close 'do' at line 12), got 'else'
again
|
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 10:30 AM |
| elseif is supposed to be together |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 10:32 AM |
| just try adding ends and taking off ends see what happens or u didn't close a function or statement the right way. |
|
|
| Report Abuse |
|
|
| |
|
|
| 18 Aug 2016 10:36 AM |
| Thank you for your admiration and if it was sarcasm I had a feeling in my soul. |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 10:38 AM |
I got the script to work:
beans = game.ReplicatedStorage.Beans --The first model you want to spawn backup1 = beans:clone() sprite = game.ReplicatedStorage.Sprite --The second model you want to spawn backup2 = sprite:clone() --Spawn location spawner = game.Workspace.BeanSpawn --The spawn location --Configuration config = script.Parent.Config --The configuration folder Lreload = config.minreload.Value --Minimun reload time Mreload = config.maxreload.Value --Maximum reload time
while true do wait(.25) local modelcorrect = math.random(1,2) if modelcorrect == 1 then local reload = math.random(Lreload, Mreload) model1 = beans:clone() model1.Name = "Bean1" model1.Parent = game.Workspace model1.Handle.CFrame = CFrame.new(spawner.Position) wait(reload) end if modelcorrect == 2 then local reload = math.random(Lreload, Mreload) model2 = sprite:clone() model2.Name = "Sprite1" model2.Parent = game.Workspace model2.Handle.CFrame = CFrame.new(spawner.Position) wait(reload) end end
I just removed the "else" before the "if"
|
|
|
| Report Abuse |
|
|
|
| 18 Aug 2016 10:42 AM |
Cool we did it. Do I get my robux now? JK. |
|
|
| Report Abuse |
|
|