-
Notifications
You must be signed in to change notification settings - Fork 28
/
Load.lua
32 lines (27 loc) · 1.12 KB
/
Load.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
return function(Type, PatchName)
-- // Failsafing
do
-- // Valid Type
Type = Type or "Module"
assert(Type == "NPC" or Type == "Module", "invalid type for module (NPC or Module)")
-- // Valid PatchName
PatchName = PatchName or tostring(game.PlaceId)
local typeofPatchName = typeof(PatchName)
local errorFormat = "invalid type for %s (expected %s, got %s)"
assert(typeofPatchName == "string", errorFormat:format("PatchName", "string", typeofPatchName))
end
-- // Vars
local PatchFormat = "https://raw.githubusercontent.com/Stefanuk12/Aiming/main/GamePatches/%s/%s.lua"
-- // Attempt to load a patch for the game
local Success, _ = pcall(function()
local URL = PatchFormat:format(Type, PatchName)
loadstring(game:HttpGet(URL))()
end)
-- // Load default otherwise
if (not Success) then
local ModuleFormat = "https://raw.githubusercontent.com/Stefanuk12/Aiming/main/%s.lua"
loadstring(game:HttpGet(ModuleFormat:format(Type)))()
end
-- // Return
return (Type == "Module" and Aiming or AimingNPC)
end