Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CoreModule = {}
- --[[-- credits: https://raw.githubusercontent.com/EdgeIY/infiniteyield/master/source --]]--
- if getgenv().CoreModuleLoaded then
- return getgenv().CoreModule
- end
- getgenv().CoreModuleLoaded = true
- local function create_fallback(t, f, fallback)
- if type(f) == t then return f end
- return fallback
- end
- local cloneref = create_fallback("function", cloneref, function(...) return ... end)
- local sethidden = create_fallback("function", sethiddenproperty or set_hidden_property or set_hidden_prop)
- local gethidden = create_fallback("function", gethiddenproperty or get_hidden_property or get_hidden_prop)
- local queueteleport = create_fallback("function", queue_on_teleport or (syn and syn.queue_on_teleport) or (fluxus and fluxus.queue_on_teleport))
- local httprequest = create_fallback("function", request or http_request or (syn and syn.request) or (http and http.request) or (fluxus and fluxus.request))
- local setclipboard = create_fallback("function", setclipboard or toclipboard or set_clipboard or (Clipboard and Clipboard.set))
- local firetouchinterest = create_fallback("function", firetouchinterest)
- local hookfunction = create_fallback("function", hookfunction)
- local hookmetamethod = create_fallback("function", hookmetamethod)
- local getnamecallmethod = create_fallback("function", getnamecallmethod or get_namecall_method)
- local checkcaller = create_fallback("function", checkcaller, function() return false end)
- local newcclosure = create_fallback("function", newcclosure, function(f) return f end)
- local getgc = create_fallback("function", getgc or get_gc_objects)
- local setthreadidentity = create_fallback("function", setthreadidentity or (syn and syn.set_thread_identity) or syn_context_set or setthreadcontext)
- local firesignal = create_fallback("function", firesignal or fire_signal)
- local replicatesignal = create_fallback("function", replicatesignal)
- local getconnections = create_fallback("function", getconnections or get_signal_cons)
- local setfflag = create_fallback("function", setfflag or set_fflag)
- local getfflag = create_fallback("function", getfflag or get_fflag)
- local isSignalReplicatable = create_fallback("function", issignalreplicate or issignalreplicateable)
- -- File System Primitives
- local raw_writefile = create_fallback("function", writefile)
- local raw_readfile = create_fallback("function", readfile)
- local raw_isfile = create_fallback("function", isfile)
- local raw_makefolder = create_fallback("function", makefolder)
- local raw_isfolder = create_fallback("function", isfolder)
- local raw_delfile = create_fallback("function", delfile)
- local raw_delfolder = create_fallback("function", delfolder)
- local raw_getcustomasset = create_fallback("function", getcustomasset or getsynasset)
- CoreModule.cloneref = cloneref
- CoreModule.sethidden = sethidden
- CoreModule.gethidden = gethidden
- CoreModule.queueteleport = queueteleport
- CoreModule.httprequest = httprequest
- CoreModule.setclipboard = setclipboard
- CoreModule.firetouchinterest = firetouchinterest
- CoreModule.hookfunction = hookfunction
- CoreModule.hookmetamethod = hookmetamethod
- CoreModule.getnamecallmethod = getnamecallmethod
- CoreModule.checkcaller = checkcaller
- CoreModule.newcclosure = newcclosure
- CoreModule.getgc = getgc
- CoreModule.setthreadidentity = setthreadidentity
- CoreModule.firesignal = firesignal
- CoreModule.replicatesignal = replicatesignal
- CoreModule.getconnections = getconnections
- CoreModule.setfflag = setfflag
- CoreModule.getfflag = getfflag
- CoreModule.isSignalReplicatable = isSignalReplicatable
- -- File System Enhanced
- CoreModule.writefile = function(file, data, safe)
- if not raw_writefile then return end
- if safe == true then return pcall(raw_writefile, file, data) end
- raw_writefile(file, data)
- end
- CoreModule.readfile = function(file, safe)
- if not raw_readfile then return end
- if safe == true then return pcall(raw_readfile, file) end
- return raw_readfile(file)
- end
- CoreModule.isfile = function(file)
- if raw_isfile then return raw_isfile(file) end
- if CoreModule.readfile then
- local success, result = pcall(function() return CoreModule.readfile(file) end)
- return success and result ~= nil and result ~= ""
- end
- return false
- end
- CoreModule.makefolder = raw_makefolder
- CoreModule.isfolder = raw_isfolder
- CoreModule.delfile = raw_delfile
- CoreModule.delfolder = raw_delfolder
- CoreModule.getcustomasset = function(asset)
- if raw_getcustomasset then
- local success, result = pcall(function() return raw_getcustomasset(asset) end)
- if success and result ~= nil and result ~= "" then return result end
- end
- return asset
- end
- CoreModule.Services = setmetatable({}, {
- __index = function(self, name)
- local success, cache = pcall(function() return cloneref(game:GetService(name)) end)
- if success and cache then
- rawset(self, name, cache)
- return cache
- end
- return nil
- end
- })
- CoreModule.PlaceId = game.PlaceId
- CoreModule.JobId = game.JobId
- -- Modified per request: No services list, direct GetMouse assignment
- CoreModule.GetMouse = CoreModule.Services.Players.LocalPlayer:GetMouse()
- CoreModule.GetPlayer = newcclosure(function(Name)
- if not Name then return nil end
- Name = tostring(Name):lower():gsub("%s", "")
- local Players = CoreModule.Services.Players
- local LocalPlayer = Players.LocalPlayer
- for _, x in next, Players:GetPlayers() do
- if x ~= LocalPlayer then
- if x.Name:lower():match(Name) then
- return x
- elseif x.DisplayName:lower():match("^" .. Name) then
- return x
- end
- end
- end
- return nil
- end)
- CoreModule.SafeCall = newcclosure(function(Function, ...)
- local Success, Result = pcall(Function, ...)
- if not Success then
- warn("[CoreModule] Error: " .. tostring(Result))
- end
- return Success, Result
- end)
- xpcall(function()
- CoreModule.IsOnMobile = table.find({Enum.Platform.Android, Enum.Platform.IOS}, CoreModule.Services.UserInputService:GetPlatform())
- end, function()
- CoreModule.IsOnMobile = CoreModule.Services.UserInputService.TouchEnabled and not CoreModule.Services.UserInputService.KeyboardEnabled
- end)
- function CoreModule.EnableInstanceBypass()
- if not hookfunction or not hookmetamethod or not newcclosure then return end
- local ProtectedLookup = setmetatable({}, {__mode = "k"})
- local typeof = typeof
- local OldInstanceNew
- OldInstanceNew = hookfunction(Instance.new, newcclosure(function(ClassName, Parent)
- local Object = OldInstanceNew(ClassName, Parent)
- if checkcaller() then
- ProtectedLookup[Object] = true
- end
- return Object
- end))
- local function CleanTable(Tbl)
- local NewTable = {}
- local Index = 1
- for i = 1, #Tbl do
- local Val = Tbl[i]
- if not ProtectedLookup[Val] then
- NewTable[Index] = Val
- Index = Index + 1
- end
- end
- return NewTable
- end
- local OldNamecall
- OldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(Self, ...)
- local Method = getnamecallmethod()
- if not checkcaller() then
- if ProtectedLookup[Self] then
- return nil
- end
- if Method == "GetChildren" or Method == "GetDescendants" or Method == "GetPartsInPart" then
- local Result = OldNamecall(Self, ...)
- if typeof(Result) == "table" then
- return CleanTable(Result)
- end
- return Result
- end
- if Method == "FindFirstChild" or Method == "FindFirstChildWhichIsA" or Method == "WaitForChild" then
- local Result = OldNamecall(Self, ...)
- if Result and ProtectedLookup[Result] then
- return nil
- end
- return Result
- end
- if Method == "Raycast" then
- local Result = OldNamecall(Self, ...)
- if Result and Result.Instance and ProtectedLookup[Result.Instance] then
- return nil
- end
- return Result
- end
- if Method == "FindPartOnRay" or Method == "FindPartOnRayWithIgnoreList" then
- local Hit, Pos, Norm, Mat = OldNamecall(Self, ...)
- if Hit and ProtectedLookup[Hit] then
- return nil, Pos, Norm, Mat
- end
- return Hit, Pos, Norm, Mat
- end
- end
- return OldNamecall(Self, ...)
- end))
- local OldIndex
- OldIndex = hookmetamethod(game, "__index", newcclosure(function(Self, Key)
- if not checkcaller() then
- if ProtectedLookup[Self] then
- return nil
- end
- if Key == "Target" and typeof(Self) == "Instance" and Self:IsA("Mouse") then
- local Target = OldIndex(Self, Key)
- if Target and ProtectedLookup[Target] then
- return nil
- end
- return Target
- end
- end
- return OldIndex(Self, Key)
- end))
- local OldNewIndex
- OldNewIndex = hookmetamethod(game, "__newindex", newcclosure(function(Self, Key, Value)
- if not checkcaller() and ProtectedLookup[Self] then
- return
- end
- return OldNewIndex(Self, Key, Value)
- end))
- local OldToString
- OldToString = hookfunction(tostring, newcclosure(function(Obj)
- if not checkcaller() and typeof(Obj) == "Instance" and ProtectedLookup[Obj] then
- return "Instance"
- end
- return OldToString(Obj)
- end))
- end
- return CoreModule
Advertisement
Add Comment
Please, Sign In to add comment