I am not sure how to interpret what the Output said(stated after code). I could be adding too many ends or something, or adding too few or whatever. If I knew I wouldn't be asking. The name of the script is 'L00t'
while wait(10) do z = math.random(1,4) print(z) --------------------------------------------------------------------------------------------------- if z == 1 then a = game.Lighting.ScrapCorrodeA:Clone() a.Parent = game.Workspace wait(5) if a.Parent ~= game.Workspace then Print("ScrapCorrodeA was picked up!") else a:Remove() end --------------------------------------------------------------------------------------------------- elseif z == 2 then b = game.Lighting.PipeCorrodeA:Clone() b.Parent = game.Workspace wait(5) if b.Parent ~= game.Workspace then Print("PipeCorrodeA was picked up!") else b:Remove() end --------------------------------------------------------------------------------------------------- elseif z == 3 then c = game.Lighting.FabricA:Clone() c.Parent = game.Workspace wait(5) if c.Parent ~= game.Workspace then Print("FabricA was picked up!") else c:Remove() end end -------------------------------------------------------------------------------------------------- elseif z == 4 then --LINE 36 d = game.Lighting.SpringA:Clone() d.Parent = game.Workspace wait(5) if d.Parent ~= game.Workspace then Print("SpringA was picked up!") else d:Remove() end end end
Here is what I got in Output just after testing: 20:26:11.356 - Workspace.L00t:36: 'end' expected (to close 'while' at line 1) near 'elseif'
while wait(10) do z = math.random(1,4) print(z) if z == 1 then a = game.Lighting.ScrapCorrodeA:Clone() else if z == 2 then a = game.Lighting.PipeCorrodeA:Clone() elseif z == 3 then a = game.Lighting.FabricA:Clone() elseif z == 4 then a = game.Lighting.SpringA:Clone() end a.Parent = game.Workspace wait(5) if a.Parent ~= game.Workspace then Print("Item was picked up!") else a:Remove() end end
That should help a bit. You had and extra end (as I stated in my comment), but you mainly had the same piece of code four times, so by using the if and elseifs only on the part that was different, I shortened the code and made it easier to understand.
Feel fee to comment with any questions, accept the answer and/or vote it up if you find this helpful. Thanks!