[Help] Menu Script Crashes Game
So, I took a simple menu script and edited it.
Please reply if you can find something incorrect...
By the way, I'm not very experienced at coding. 
Please reply if you can find something incorrect...
Code:
-- HACK MENUSCRIPT
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
if not SimpleMenu then
SimpleMenu = class()
function SimpleMenu:init(title, message, options)
self.dialog_data = { title = title, text = message, button_list = {},
id = tostring(math.random(0,0xFFFFFFFF)) }
self.visible = false
for _,opt in ipairs(options) do
local elem = {}
elem.text = opt.text
opt.data = opt.data or nil
opt.callback = opt.callback or nil
elem.callback_func = callback(self, self, "_do_callback",
{ data = opt.data,
callback = opt.callback})
elem.cancel_button = opt.is_cancel_button or false
if opt.is_focused_button then
self.dialog_data.focus_button = #self.dialog_data.button_list+1
end
table.insert(self.dialog_data.button_list, elem)
end
return self
end
function SimpleMenu:_do_callback(info)
if info.callback then
if info.data then
info.callback(info.data)
else
info.callback()
end
end
self.visible = false
end
function SimpleMenu:show()
if self.visible then
return
end
self.visible = true
managers.system_menu:show(self.dialog_data)
end
function SimpleMenu:hide()
if self.visible then
managers.system_menu:close(self.dialog_data.id)
self.visible = false
return
end
end
end
optionone = optionone or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- SET SKILLPOINTS TO 1
dofile("NoAlarm.lua")
end
optiontwo = optiontwo or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- SET SKILLPOINTS TO 10
dofile("Xray.lua")
end
optionthree = optionthree or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- SET SKILLPOINTS TO 100
dofile("GodMode.lua")
end
optionfour = optionfour or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- SET SKILLPOINTS TO 580
dofile("SemiGodMode.lua")
end
optionfive = optionfive or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("InfiniteAmmo2.lua")
end
optionsix = optionsix or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("InfiniteAmmo.lua")
end
optionseven = optionseven or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("InfiniteEquipmentAndCableTies")
end
optioneight = optioneight or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("NoTaser.lua")
end
optionnine = optionnine or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("NoCivPenalty.lua")
end
optionten = optionten or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("100%ArmorPiercing.lua")
end
optioneleven = optioneleven or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("Instant500IntimidationsConversions.lua")
end
optiontwelve = optiontwelve or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("KillAll.lua")
end
optionthirteen = optionthirteen or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("SpawnAmmo.lua")
end
optionfourteen = optionfourteen or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("SpawnDoctor.lua")
end
optionfifteen = optionfifteen or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("DirtyGold.lua")
end
optionsixteen = optionsixteen or function()
-- PLAY SOUND
managers.menu_component:post_event("menu_enter")
-- RESET SKILLPOINTS
dofile("ForceLose.lua")
end
opts = {}
opts[#opts+1] = { text = "No Alarm", callback = optionone }
opts[#opts+1] = { text = "X-ray", callback = optiontwo }
opts[#opts+1] = { text = "God Mode", callback = optionthree }
opts[#opts+1] = { text = "Semi God Mode", callback = optionfour }
opts[#opts+1] = { text = "Infinite Ammo + No Reload", callback = optionfive }
opts[#opts+1] = { text = "Infinite Ammo", callback = optionsix }
opts[#opts+1] = { text = "Infinite Equipment", callback = optionseven }
opts[#opts+1] = { text = "No Tasers", callback = optioneight }
opts[#opts+1] = { text = "No Civ Penalty", callback = optionnine }
opts[#opts+1] = { text = "Armor Piercing", callback = optionten }
opts[#opts+1] = { text = "Intimidations And Conversions", callback = optioneleven }
opts[#opts+1] = { text = "Kill All", callback = optiontwelve }
opts[#opts+1] = { text = "Spawn Ammo Bag", callback = optionthirteen }
opts[#opts+1] = { text = "Spawn Doctor Bag", callback = optionfourteen }
opts[#opts+1] = { text = "Dirty Gold", callback = optionfifteen }
opts[#opts+1] = { text = "Force Lose", callback = optionsixteen }
opts[#opts+1] = { text = "CANCEL", is_cancel_button = true }
mymenu = SimpleMenu:new("Coreball's Hack Menu", "Coreball's Hacks", opts)
mymenu:show()

