Hi! There's several mistake in Your Script:
- If You choose 'Exit' it will execute Menu 2: Which downloading the Script instead of Exitting. The reason is: Choices are Ordered on gg.choice (Call = 1, Exit = 2)
- The First Option (Menu 1) doesn't have the same File Location to the File that have been Downloaded (/Dump and /.pass)
- The Exec function is Unnecessary since You didn't use them.
I have made 2 Script that has it's Own use:
Temp Script
local file = '/Dump/niggers.lua' --This is Your File location.
menu = gg.choice({"Call File", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
if not (io.open(gg.EXT_STORAGE .. file, 'r')) then --Check if Script is NOT Downloaded
fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read Script from URL
if not fileData then --Check if Pastebin is Empty
print('Site is Down') --Tell User that URL is Invalid
else
gg.saveList(gg.EXT_STORAGE .. '/' .. file, gg.LOAD_APPEND) --If Pastebin exist, makes a New Lua File
fileAppend = io.open(gg.EXT_STORAGE .. file, 'w'):write(fileData) --Save Pastebin Script into the New Lua
dofile(gg.EXT_STORAGE .. file) --Run the Downloaded Script
end
else
dofile(gg.EXT_STORAGE .. file) --Run the Downloaded Script
end
else
os.exit() --Exit the Script
end
- Choices are now Adjusted: 'Exit' will Exit the script and 'Call File' will runs a simple Directory check.
- If the file is NOT Downloaded yet, it will Download the script from Pastebin and Save it into a Directory (/storage/emulated/0/Dump/niggers.lua)
- If the file Exist, it will run the Script instead via dofile
Direct Script
menu = gg.choice({"Call Script", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read URL Script
if not fileData then --Check if URL is Empty
print('Site is Down') --Tell User the URL is Invalid
else
pcall(load(fileData)) --Run Pastebin Script
end
else
os.exit() --Exit the Script
end
This Script does NOT Save the Pastebin Script but instead Run them Directly. This is a good Practice if You do NOT want Your Script to be Stolen from Local Directory.