ColdSpecs

New remote logic

Nov 2nd, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. -- === REMOTE HOOK (Adaptive Confidence Mode) ===
  2. local shootRemote : RemoteEvent? = nil
  3. local hookedMeta = nil
  4. local SEARCH_PATTERN = "shoot"
  5. local lastCheck = 0
  6.  
  7. local function getRoots()
  8. local roots = {}
  9. local userFolder = Workspace:FindFirstChild(plr.Name)
  10. if userFolder and userFolder:FindFirstChild("Basketball") then
  11. table.insert(roots, userFolder.Basketball)
  12. end
  13. local iso = Workspace:FindFirstChild("isokcocs")
  14. if iso and iso:FindFirstChild("Basketball") then
  15. table.insert(roots, iso.Basketball)
  16. end
  17. local remotes = ReplicatedStorage:FindFirstChild("Remotes")
  18. if remotes then
  19. table.insert(roots, remotes)
  20. end
  21. return roots
  22. end
  23.  
  24. local function findShootRemote()
  25. for _, root in ipairs(getRoots()) do
  26. for _, obj in ipairs(root:GetDescendants()) do
  27. if obj:IsA("RemoteEvent") and obj.Name:lower():find(SEARCH_PATTERN) then
  28. return obj
  29. end
  30. end
  31. end
  32. return nil
  33. end
  34.  
  35. local function hookRemote(remote)
  36. if hookedMeta then return end
  37. local old
  38. old = hookmetamethod(game, "__namecall", function(self, ...)
  39. local m = getnamecallmethod()
  40. if m == "FireServer" and self == remote then
  41. local args = {...}
  42. if type(args[3]) == "string" and not shootKey then
  43. shootKey = args[3]
  44. notify("Captured shoot key: "..shootKey, Color3.fromRGB(0,255,100))
  45. end
  46. if type(args[5]) == "number" then
  47. CURRENT_POWER = args[5]
  48. end
  49. end
  50. return old(self, ...)
  51. end)
  52. hookedMeta = old
  53. shootRemote = remote
  54. notify("Remote locked: "..remote:GetFullName(), Color3.fromRGB(0,255,100))
  55. end
  56.  
  57. -- Watch only every 0.5s to verify remote still exists
  58. RunService.Heartbeat:Connect(function()
  59. if tick() - lastCheck < 0.5 then return end
  60. lastCheck = tick()
  61.  
  62. -- If the current remote no longer exists or was removed, reacquire
  63. if not shootRemote or not shootRemote:IsDescendantOf(game) then
  64. local new = findShootRemote()
  65. if new and new ~= shootRemote then
  66. hookedMeta = nil
  67. shootRemote = nil
  68. hookRemote(new)
  69. end
  70. end
  71. end)
  72.  
Advertisement
Add Comment
Please, Sign In to add comment