CCCPaste

undetected module for lua

--[[ credits:
    https://raw.githubusercontent.com/EdgeIY/infiniteyield/master/source
    https://raw.githubusercontent.com/AnthonyIsntHere/anthonysrepository/refs/heads/main/scripts/InstanceBypass.lua
    https://raw.githubusercontent.com/MaximumADHD/Roblox-Client-Tracker/refs/heads/roblox/API-Dump.txt
]]--

local CoreModule = {}

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)
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)

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

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
})

local Services = CoreModule.Services

CoreModule.ABTestService = Services.ABTestService
CoreModule.AccountInformationService = Services.AccountInformationService
CoreModule.AdService = Services.AdService
CoreModule.AnalyticsService = Services.AnalyticsService
CoreModule.ApiDumpService = Services.ApiDumpService
CoreModule.AssetDeliveryService = Services.AssetDeliveryService
CoreModule.AssetImportService = Services.AssetImportService
CoreModule.AssetService = Services.AssetService
CoreModule.AssetVersionHistoryService = Services.AssetVersionHistoryService
CoreModule.AvatarChatService = Services.AvatarChatService
CoreModule.AvatarCreationService = Services.AvatarCreationService
CoreModule.AvatarEditorService = Services.AvatarEditorService
CoreModule.AvatarMarketplaceService = Services.AvatarMarketplaceService
CoreModule.BadgeService = Services.BadgeService
CoreModule.BrowserService = Services.BrowserService
CoreModule.CSGDictionaryService = Services.CSGDictionaryService
CoreModule.CacheableContentProvider = Services.CacheableContentProvider
CoreModule.CaptureService = Services.CaptureService
CoreModule.ChangeHistoryService = Services.ChangeHistoryService
CoreModule.Chat = Services.Chat
CoreModule.ClientReplicator = Services.ClientReplicator
CoreModule.CollectionService = Services.CollectionService
CoreModule.CommerceService = Services.CommerceService
CoreModule.ContentProvider = Services.ContentProvider
CoreModule.ContextActionService = Services.ContextActionService
CoreModule.ControllerService = Services.ControllerService
CoreModule.CoreGui = Services.CoreGui
CoreModule.DataModelPatchService = Services.DataModelPatchService
CoreModule.DataStoreService = Services.DataStoreService
CoreModule.Debris = Services.Debris
CoreModule.DebugSettings = Services.DebugSettings
CoreModule.DraftsService = Services.DraftsService
CoreModule.EmotesService = Services.EmotesService
CoreModule.ExperienceAuthService = Services.ExperienceAuthService
CoreModule.ExperienceInviteService = Services.ExperienceInviteService
CoreModule.ExperienceNotificationService = Services.ExperienceNotificationService
CoreModule.FaceCaptureService = Services.FaceCaptureService
CoreModule.FriendService = Services.FriendService
CoreModule.GamePassService = Services.GamePassService
CoreModule.GameSettings = Services.GameSettings
CoreModule.GroupService = Services.GroupService
CoreModule.GuiService = Services.GuiService
CoreModule.HapticService = Services.HapticService
CoreModule.HttpRbxApiService = Services.HttpRbxApiService
CoreModule.HttpService = Services.HttpService
CoreModule.HttpRequestService = Services.HttpRequestService
CoreModule.HumanoidDescriptionService = Services.HumanoidDescriptionService
CoreModule.InsertService = Services.InsertService
CoreModule.InstanceStreamingService = Services.InstanceStreamingService
CoreModule.KeyframeSequenceProvider = Services.KeyframeSequenceProvider
CoreModule.LanguageService = Services.LanguageService
CoreModule.Lighting = Services.Lighting
CoreModule.LiveScriptingService = Services.LiveScriptingService
CoreModule.LocalizationService = Services.LocalizationService
CoreModule.LogService = Services.LogService
CoreModule.LoginService = Services.LoginService
CoreModule.MarketplaceService = Services.MarketplaceService
CoreModule.MaterialService = Services.MaterialService
CoreModule.MemoryDataService = Services.MemoryDataService
CoreModule.MemoryStoreService = Services.MemoryStoreService
CoreModule.MeshContentProvider = Services.MeshContentProvider
CoreModule.NetworkClient = Services.NetworkClient
CoreModule.NetworkServer = Services.NetworkServer
CoreModule.NetworkSettings = Services.NetworkSettings
CoreModule.NotificationService = Services.NotificationService
CoreModule.PackageService = Services.PackageService
CoreModule.PathfindingService = Services.PathfindingService
CoreModule.PermissionsService = Services.PermissionsService
CoreModule.PhysicsService = Services.PhysicsService
CoreModule.PhysicsSettings = Services.PhysicsSettings
CoreModule.Players = Services.Players
CoreModule.PointsService = Services.PointsService
CoreModule.PolicyService = Services.PolicyService
CoreModule.ProximityPromptService = Services.ProximityPromptService
CoreModule.PublishService = Services.PublishService
CoreModule.PurchasePromptService = Services.PurchasePromptService
CoreModule.RenderSettings = Services.RenderSettings
CoreModule.ReplicatedFirst = Services.ReplicatedFirst
CoreModule.ReplicatedStorage = Services.ReplicatedStorage
CoreModule.RobloxPluginGuiService = Services.RobloxPluginGuiService
CoreModule.RunService = Services.RunService
CoreModule.RuntimeScriptService = Services.RuntimeScriptService
CoreModule.ScreenEffectService = Services.ScreenEffectService
CoreModule.ScriptContext = Services.ScriptContext
CoreModule.ScriptDebugger = Services.ScriptDebugger
CoreModule.ScriptProfilerService = Services.ScriptProfilerService
CoreModule.Selection = Services.Selection
CoreModule.ServerScriptService = Services.ServerScriptService
CoreModule.ServerStorage = Services.ServerStorage
CoreModule.SocialService = Services.SocialService
CoreModule.SoundService = Services.SoundService
CoreModule.StarterGui = Services.StarterGui
CoreModule.StarterPack = Services.StarterPack
CoreModule.StarterPlayer = Services.StarterPlayer
CoreModule.Stats = Services.Stats
CoreModule.Studio = Services.Studio
CoreModule.StudioData = Services.StudioData
CoreModule.StudioService = Services.StudioService
CoreModule.TaskScheduler = Services.TaskScheduler
CoreModule.Teams = Services.Teams
CoreModule.TeleportService = Services.TeleportService
CoreModule.TestService = Services.TestService
CoreModule.TextChatService = Services.TextChatService
CoreModule.TextFilter = Services.TextFilter
CoreModule.TextService = Services.TextService
CoreModule.ThirdPartyUserService = Services.ThirdPartyUserService
CoreModule.TimerService = Services.TimerService
CoreModule.ToastNotificationService = Services.ToastNotificationService
CoreModule.TweenService = Services.TweenService
CoreModule.UGCValidationService = Services.UGCValidationService
CoreModule.UiMessageService = Services.UiMessageService
CoreModule.UrlShortenerService = Services.UrlShortenerService
CoreModule.UserGameSettings = Services.UserGameSettings
CoreModule.UserInputService = Services.UserInputService
CoreModule.VRService = Services.VRService
CoreModule.VersionControlService = Services.VersionControlService
CoreModule.VirtualInputManager = Services.VirtualInputManager
CoreModule.VoiceChatService = Services.VoiceChatService
CoreModule.Workspace = Services.Workspace

CoreModule.LocalPlayer = CoreModule.Players.LocalPlayer
CoreModule.PlayerGui = cloneref(CoreModule.LocalPlayer:FindFirstChildWhichIsA("PlayerGui"))
CoreModule.Mouse = cloneref(CoreModule.LocalPlayer:GetMouse())
CoreModule.PlaceId = game.PlaceId
CoreModule.JobId = game.JobId

xpcall(function()
    CoreModule.IsOnMobile = table.find({Enum.Platform.Android, Enum.Platform.IOS}, CoreModule.UserInputService:GetPlatform())
end, function()
    CoreModule.IsOnMobile = CoreModule.UserInputService.TouchEnabled and not CoreModule.UserInputService.KeyboardEnabled
end)

function CoreModule.EnableInstanceBypass()
    if not hookfunction or not hookmetamethod or not newcclosure then return end
    local ProtectedInstances = {}
    local Find, Insert = table.find, table.insert
    local _Instance, _tostring = Instance.new, tostring
    
    local InstanceHook; InstanceHook = hookfunction(_Instance, newcclosure(function(...)
        if checkcaller() then
            local NewInstance = InstanceHook(...)
            NewInstance:SetAttribute("CoreVM", true)
            Insert(ProtectedInstances, NewInstance)
            return NewInstance
        end
        return InstanceHook(...)
    end))

    local tostringHook; tostringHook = hookfunction(_tostring, newcclosure(function(...)
        if not checkcaller() then
            local Arguments = {...}
            if Find(ProtectedInstances, Arguments[1]) then return end
        end
        return tostringHook(...)
    end))

    local FunctionHook; FunctionHook = hookmetamethod(game, "__namecall", newcclosure(function(self, ...)
        local Arguments, Method = {...}, getnamecallmethod()
        if not checkcaller() then
            if Find(ProtectedInstances, self) and Method:match("IsA") then return end
            if Method:match("^FindFirst") then
                local Instance = self[Method](self, Arguments[1])
                if Instance and Find(ProtectedInstances, Instance) then return end
            end
            if Method:match("Attribute") and Arguments[1] == "CoreVM" then return false end
        end
        return FunctionHook(self, ...)
    end))

    local PropertiesHook; PropertiesHook = hookmetamethod(game, "__index", newcclosure(function(self, key)
        if not checkcaller() and Find(ProtectedInstances, self) then return end
        return PropertiesHook(self, key)
    end))

    if getactors then
        for _, Actor in next, getactors() do
            run_on_actor(Actor, [[
                local _tostring = tostring
                local hookfunction = hookfunction
                local newcclosure = newcclosure
                local getnamecallmethod = getnamecallmethod
                local checkcaller = checkcaller
                local hookmetamethod = hookmetamethod
                
                local tostringHook; tostringHook = hookfunction(_tostring, newcclosure(function(...)
                    if not checkcaller() then
                        local Arguments = {...}
                        if Arguments[1]:GetAttribute("CoreVM") then return end
                    end
                    return tostringHook(...)
                end))

                local FunctionHook; FunctionHook = hookmetamethod(game, "__namecall", newcclosure(function(self, ...)
                    local Arguments, Method = {...}, getnamecallmethod()
                    if not checkcaller() then
                        if self:GetAttribute("CoreVM") and Method:match("IsA") then return end
                        if Method:match("^FindFirst") then
                            local Instance = self[Method](self, Arguments[1])
                            if Instance and Instance:GetAttribute("CoreVM") then return end
                        end
                        if Method:match("Attribute") and Arguments[1] == "CoreVM" then return false end
                    end
                    return FunctionHook(self, ...)
                end))

                local PropertiesHook; PropertiesHook = hookmetamethod(game, "__index", newcclosure(function(self, key)
                    if not checkcaller() and self:GetAttribute("CoreVM") then return end
                    return PropertiesHook(self, key)
                end))
            ]])
        end
    end
end

return CoreModule