This fixed the error, there was 1 too many ends, and in the wrong spot. Also, for a continuous script running, you need to add a 'wait' at the end, as I have here 
PHP Code:
-- Smuggler Pit Version 1 by Rhinocort --
--===========##[CONFIGURATION]##===========--
local MinCap = 10 -- Cap to deposit on.
local MinMana = 5 -- Manas to deposit on.
local MaxMana = 10 -- Amount of manas to buy.
local ManaId = 268 -- Id of Mana Potion.
local ManaPrice = 50 -- How much Mana Potions cost.
local GoldBP = 2872 -- Id of Gold Backpack
local RareDP = 0 -- BP in DP to put Non-Stackable Items Into
local StackDP = 1 -- BP in DP to put Stackable Items Into
-- (0 = first backpack, 1 = second and so on...) --
--- DON'T CHANGE ANYTHING BELOW THIS LINE ---
print("Smuggler Pit version 1 \nby Rhinocort")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "ManaCap") then
print("Current Manas: " .. Self.ItemCount(268))
if (Self.Cap() > MinCap and Self.ItemCount(ManaId) > MinMana) then
gotoLabel("Start")
end
elseif (labelName == "Bank") then
local amount = (MaxMana-Self.ItemCount(ManaId))*ManaPrice
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
if (amount > 0) then
Self.SayToNpc({"withdraw " .. amount, "yes", "balance"}, 65)
end
setWalkerEnabled(true)
elseif (labelName == "BuyManas") then
local manaCount = (MaxMana-Self.ItemCount(ManaId))
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "vials", "yes", "trade"}, 65)
wait(2000, 3700)
while (Self.ItemCount(ManaId) < MaxMana) do
Self.ShopBuyItem(ManaId, manaCount)
wait(200, 500)
end
elseif (labelName == "DepositAll") then
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes", "balance"}, 65)
end
wait(300,700)
end