View difference between Paste ID: h0zBBWBQ and ez1ptaN0
SHOW: | | - or go back to the newest paste.
1
--ROBLOX LAUNCHER
2
3
--Find the current version file
4
function FindRbxPlayer()
5-
	function scandir(directory,mode)
5+
	function scandir(directory,mode) --Return array with all results of "dir /b /mode"
6
		local i, t, popen = 0, {}, io.popen
7
		for filename in popen('dir "'..directory..'" /b '.. mode):lines() do
8
			i = i + 1
9
			t[i] = filename
10
		end
11
		return t
12
	end
13
14
	for 
15-
		i,v in pairs (scandir("%appdata%/../Local/Roblox/Versions","/ad")) 
15+
		--looks in all folders in versions
16
		i,v in pairs (scandir("%appdata%/../Local/Roblox/Versions","/ad")) -- /ad mode finds all folders
17-
		for k,x in pairs (scandir("%appdata%/../Local/Roblox/Versions/"..v,"/a-d")) do
17+
18
		--looks in each folder for robloxplayerbeta and returns the version
19
		for k,x in pairs (scandir("%appdata%/../Local/Roblox/Versions/"..v,"/a-d")) do -- /a-d mode finds all non-folders
20
			if x=="RobloxPlayerBeta.exe" then 
21
				return v
22
			end
23
		end
24
	end
25
end
26
27
--sets the current version to the found version
28
local CURRENTVERSION=FindRbxPlayer()
29
--These are here just because
30
local presets= { ["kk"]=157005930, ["cf"]=101554146,["piggy"]=155856024,["mc"]=170222579, ["ap"]=1600503;
31
				["aph"]=99015795}
32
function LaunchGame()
33
	print("Paste a place ID here.")
34
	local input=io.stdin:read()--accept user input
35
	if 
36
		input=="RESET" --allow resetting to find new version in case of update
37
	then 
38
		CURRENTVERSION=FindRbxPlayer()
39
		LaunchGame()
40
	end
41
	local ID=( presets[input] or input)--Did you shortcut?
42
	presets["last"]=input
43
	print("Launching game, please wait..")
44
	--launches a game with the given ID
45
	os.execute("%appdata%/../Local/Roblox/Versions/"..CURRENTVERSION.."/RobloxPlayerBeta.exe --id "..ID)
46
	print("Game closed.")
47
	LaunchGame() --allows you to paste another ID
48
end
49
LaunchGame()