-- Discord: dsc.gg/21hub -- Config: local HideKey = "F1" local BlockKey = "U" -- DO NOT TOUCH UNDER THERE IF YOU DON'T KNOW WHAT YOU'RE DOING local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") HideKey = HideKey or "" BlockKey = BlockKey or "" local PacketBlocker = {} PacketBlocker.__index = PacketBlocker local function createInstance(className, properties, children) local instance = Instance.new(className) for property, value in pairs(properties or {}) do instance[property] = value end for _, child in ipairs(children or {}) do child.Parent = instance end return instance end local function makeDraggable(frame, connectionTable) local isDragging = false local dragStart = nil local frameStart = nil local inputChangedConnection = nil local inputBeganConnection = frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then isDragging = true dragStart = input.Position frameStart = frame.Position local stateChangedConnection = input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then isDragging = false if stateChangedConnection then stateChangedConnection:Disconnect() end end end) if connectionTable then table.insert(connectionTable, stateChangedConnection) end end end) local inputChangedConnection2 = frame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then inputChangedConnection = input end end) local globalInputConnection = UserInputService.InputChanged:Connect(function(input) if input == inputChangedConnection and isDragging then local delta = input.Position - dragStart frame.Position = UDim2.new( frameStart.X.Scale, frameStart.X.Offset + delta.X, frameStart.Y.Scale, frameStart.Y.Offset + delta.Y ) end end) if connectionTable then table.insert(connectionTable, inputBeganConnection) table.insert(connectionTable, inputChangedConnection2) table.insert(connectionTable, globalInputConnection) end end function PacketBlocker.new() local self = setmetatable({}, PacketBlocker) self.isBlocking = false self.selectedPacket = 0 self.blockedCount = 0 self.packetCounts = {} self.logEntries = {} self.connections = {} self.activeHook = nil self.screenGui = createInstance("ScreenGui", { ResetOnSpawn = false, DisplayOrder = 999999999, Parent = Players.LocalPlayer:WaitForChild("PlayerGui") }) self.mainFrame = createInstance("Frame", { Size = UDim2.new(0, 250, 0, 280), Position = UDim2.new(0.5, -330, 0.5, -155), BackgroundColor3 = Color3.fromRGB(25, 27, 32), BorderSizePixel = 0, ClipsDescendants = true, Parent = self.screenGui }, { createInstance("UICorner", { CornerRadius = UDim.new(0, 10) }), createInstance("UIPadding", { PaddingTop = UDim.new(0, 10), PaddingBottom = UDim.new(0, 10), PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12) }) }) local titleFrame = createInstance("Frame", { Size = UDim2.new(1, 0, 0, 26), BackgroundTransparency = 1, Parent = self.mainFrame }) self.titleLabel = createInstance("TextLabel", { Size = UDim2.new(0.42, 0, 1, 0), BackgroundTransparency = 1, Text = "Packet Blocker", TextColor3 = Color3.fromRGB(255, 255, 255), TextSize = 16, Font = Enum.Font.GothamBold, TextXAlignment = Enum.TextXAlignment.Left, Parent = titleFrame }) self:createButton("Logs", UDim2.new(0.15, 0, 1, 0), UDim2.new(0.68, 0, 0, 0), titleFrame, function() self:toggleLogWindow() end, Color3.fromRGB(60, 64, 75)) self:createButton("X", UDim2.new(0.14, 0, 1, 0), UDim2.new(0.86, 0, 0, 0), titleFrame, function() self:destroy() end, Color3.fromRGB(180, 50, 50)) self.packetDisplay = createInstance("TextLabel", { Size = UDim2.new(1, 0, 0, 34), Position = UDim2.new(0, 0, 0, 32), BackgroundColor3 = Color3.fromRGB(35, 38, 45), BorderSizePixel = 0, Text = "Selected Packet: 0x00", TextColor3 = Color3.fromRGB(220, 220, 220), TextSize = 13, Font = Enum.Font.GothamMedium, Parent = self.mainFrame }, { createInstance("UICorner", { CornerRadius = UDim.new(0, 6) }) }) local inputContainer = createInstance("Frame", { Size = UDim2.new(1, 0, 0, 30), Position = UDim2.new(0, 0, 0, 72), BackgroundTransparency = 1, Parent = self.mainFrame }) self.packetInput = createInstance("TextBox", { Size = UDim2.new(0.65, -5, 1, 0), BackgroundColor3 = Color3.fromRGB(35, 38, 45), BorderSizePixel = 0, Text = "", PlaceholderText = "0x00", TextColor3 = Color3.fromRGB(255, 255, 255), TextSize = 13, Font = Enum.Font.Gotham, Parent = inputContainer }, { createInstance("UICorner", { CornerRadius = UDim.new(0, 6) }) }) self:createButton("Apply", UDim2.new(0.33, 0, 1, 0), UDim2.new(0.64, 5, 0, 0), inputContainer, function() self:applyPacket() end, Color3.fromRGB(52, 120, 246)) local controlsGrid = createInstance("Frame", { Size = UDim2.new(1, 0, 0, 68), Position = UDim2.new(0, 0, 0, 108), BackgroundTransparency = 1, Parent = self.mainFrame }) self:createButton("< Back", UDim2.new(0.48, 0, 0, 30), UDim2.new(0, 0, 0, 0), controlsGrid, function() self:previousPacket() end) self:createButton("Next >", UDim2.new(0.48, 0, 0, 30), UDim2.new(0.52, 0, 0, 0), controlsGrid, function() self:nextPacket() end) self.toggleButton = self:createButton("Block " .. (BlockKey~="" and ("(%s)"):format(BlockKey)) or "", UDim2.new(1, 0, 0, 32), UDim2.new(0, 0, 0, 36), controlsGrid, function() self:toggleBlock() end, Color3.fromRGB(220, 50, 50)) self.infoLabel = createInstance("TextLabel", { Size = UDim2.new(1, 0, 0, 36), Position = UDim2.new(0, 0, 0, 182), BackgroundTransparency = 1, Text = "For desync you need to find the packet in logs that increases while moving and block it\n\nScript credits to 21hub team", TextColor3 = Color3.fromRGB(140, 145, 155), TextSize = 10, Font = Enum.Font.Gotham, TextWrapped = true, RichText = true, TextXAlignment = Enum.TextXAlignment.Center, Parent = self.mainFrame }) self.statusLabel = createInstance("TextLabel", { Size = UDim2.new(1, 0, 0, 30), Position = UDim2.new(0, 0, 1, -30), BackgroundColor3 = Color3.fromRGB(18, 20, 24), BorderSizePixel = 0, Text = "Status: Idle", TextColor3 = Color3.fromRGB(180, 180, 180), TextSize = 11, Font = Enum.Font.Gotham, Parent = self.mainFrame }, { createInstance("UICorner", { CornerRadius = UDim.new(0, 6) }) }) self:buildLogWindow() makeDraggable(self.mainFrame, self.connections) makeDraggable(self.logWindow, self.connections) self:registerHooks() return self end function PacketBlocker:createButton(text, size, position, parent, callback, color) local backgroundColor = color or Color3.fromRGB(45, 48, 56) local button = createInstance("TextButton", { Size = size, Position = position, BackgroundColor3 = backgroundColor, BorderSizePixel = 0, Text = text, TextColor3 = Color3.fromRGB(255, 255, 255), TextSize = 12, Font = Enum.Font.GothamBold, Parent = parent }, { createInstance("UICorner", { CornerRadius = UDim.new(0, 6) }) }) button:SetAttribute("BaseColor", backgroundColor) local mouseEnter = button.MouseEnter:Connect(function() local baseColor = button:GetAttribute("BaseColor") or backgroundColor TweenService:Create(button, TweenInfo.new(0.12), { BackgroundColor3 = baseColor:Lerp(Color3.fromRGB(255, 255, 255), 0.2) }):Play() end) local mouseLeave = button.MouseLeave:Connect(function() local baseColor = button:GetAttribute("BaseColor") or backgroundColor TweenService:Create(button, TweenInfo.new(0.12), { BackgroundColor3 = baseColor }):Play() end) local click = button.MouseButton1Click:Connect(callback) if self.connections then table.insert(self.connections, mouseEnter) table.insert(self.connections, mouseLeave) table.insert(self.connections, click) end return button end function PacketBlocker:setButtonColor(button, color) button:SetAttribute("BaseColor", color) TweenService:Create(button, TweenInfo.new(0.15), { BackgroundColor3 = color }):Play() end function PacketBlocker:buildLogWindow() self.logWindow = createInstance("Frame", { Size = UDim2.new(0, 250, 0, 280), Position = UDim2.new(0.5, 10, 0.5, -155), BackgroundColor3 = Color3.fromRGB(25, 27, 32), BorderSizePixel = 0, Visible = false, Parent = self.screenGui }, { createInstance("UICorner", { CornerRadius = UDim.new(0, 10) }), createInstance("UIPadding", { PaddingTop = UDim.new(0, 12), PaddingBottom = UDim.new(0, 12), PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12) }) }) local header = createInstance("Frame", { Size = UDim2.new(1, 0, 0, 26), BackgroundTransparency = 1, Parent = self.logWindow }) createInstance("TextLabel", { Size = UDim2.new(0.5, 0, 1, 0), BackgroundTransparency = 1, Text = "Packet Tracker", TextColor3 = Color3.fromRGB(255, 255, 255), TextSize = 15, Font = Enum.Font.GothamBold, TextXAlignment = Enum.TextXAlignment.Left, Parent = header }) self:createButton("Clear", UDim2.new(0.28, 0, 1, 0), UDim2.new(0.52, 0, 0, 0), header, function() self:clearLogs() end, Color3.fromRGB(180, 50, 50)) self:createButton("X", UDim2.new(0.16, 0, 1, 0), UDim2.new(0.84, 0, 0, 0), header, function() self.logWindow.Visible = false end, Color3.fromRGB(60, 64, 75)) self.scrollList = createInstance("ScrollingFrame", { Size = UDim2.new(1, 0, 1, -34), Position = UDim2.new(0, 0, 0, 34), BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 4, ScrollBarImageColor3 = Color3.fromRGB(80, 85, 95), CanvasSize = UDim2.new(0, 0, 0, 0), AutomaticCanvasSize = Enum.AutomaticSize.Y, Parent = self.logWindow }, { createInstance("UIListLayout", { SortOrder = Enum.SortOrder.LayoutOrder, Padding = UDim.new(0, 4) }) }) end function PacketBlocker:toggleLogWindow() local mainPos = self.mainFrame.AbsolutePosition self.logWindow.Position = UDim2.new(0, mainPos.X + 320 + 20, 0, mainPos.Y) self.logWindow.Visible = not self.logWindow.Visible end function PacketBlocker:recordPacket(packetId) if not packetId or not self.packetCounts then return end self.packetCounts[packetId] = (self.packetCounts[packetId] or 0) + 1 local count = self.packetCounts[packetId] if self.logEntries[packetId] then local countLabel = self.logEntries[packetId]:FindFirstChild("CountLabel") if countLabel then countLabel.Text = string.format("x%d", count) end else local entry = createInstance("Frame", { Name = "Packet_" .. packetId, Size = UDim2.new(1, -6, 0, 22), BackgroundColor3 = Color3.fromRGB(32, 35, 42), BorderSizePixel = 0, Parent = self.scrollList }, { createInstance("UICorner", { CornerRadius = UDim.new(0, 4) }), createInstance("UIPadding", { PaddingLeft = UDim.new(0, 8), PaddingRight = UDim.new(0, 8) }) }) local clickConnection = entry.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then self:selectPacket(packetId) end end) if self.connections then table.insert(self.connections, clickConnection) end createInstance("TextLabel", { Size = UDim2.new(0.5, 0, 1, 0), BackgroundTransparency = 1, Text = string.format("0x%02X", packetId), TextColor3 = Color3.fromRGB(220, 220, 220), TextSize = 11, Font = Enum.Font.GothamBold, TextXAlignment = Enum.TextXAlignment.Left, Parent = entry }) createInstance("TextLabel", { Name = "CountLabel", Size = UDim2.new(0.5, 0, 1, 0), Position = UDim2.new(0.5, 0, 0, 0), BackgroundTransparency = 1, Text = string.format("x%d", count), TextColor3 = Color3.fromRGB(150, 155, 165), TextSize = 11, Font = Enum.Font.Gotham, TextXAlignment = Enum.TextXAlignment.Right, Parent = entry }) self.logEntries[packetId] = entry end end function PacketBlocker:clearLogs() self.packetCounts = {} for _, entry in pairs(self.logEntries or {}) do entry:Destroy() end self.logEntries = {} end function PacketBlocker:selectPacket(packetId) self.selectedPacket = packetId self.blockedCount = 0 self:updateDisplay() self:updateStatus() end function PacketBlocker:nextPacket() self:selectPacket((self.selectedPacket + 1) % 256) end function PacketBlocker:previousPacket() self:selectPacket((self.selectedPacket - 1 + 256) % 256) end function PacketBlocker:toggleBlock() self.isBlocking = not self.isBlocking if self.isBlocking then self.toggleButton.Text = "Unblock " .. (BlockKey~="" and ("(%s)"):format(BlockKey)) or "" self:setButtonColor(self.toggleButton, Color3.fromRGB(46, 160, 67)) else self.toggleButton.Text = "Block " .. (BlockKey~="" and ("(%s)"):format(BlockKey)) or "" self:setButtonColor(self.toggleButton, Color3.fromRGB(220, 50, 50)) end self:updateStatus() end function PacketBlocker:applyPacket() local inputText = self.packetInput.Text local hexMatch = inputText:match("0x([%da-fA-F]+)") or inputText:match("([%da-fA-F]+)") local packetId = hexMatch and tonumber(hexMatch, 16) if packetId and packetId >= 0 and packetId <= 255 then self:selectPacket(packetId) else self.statusLabel.Text = "Status: Invalid ID (0x00 - 0xFF)" self.statusLabel.TextColor3 = Color3.fromRGB(255, 220, 100) end end function PacketBlocker:updateDisplay() self.packetDisplay.Text = string.format("Selected Packet: 0x%02X", self.selectedPacket) end function PacketBlocker:updateStatus() if self.isBlocking then self.statusLabel.Text = string.format("Blocking 0x%02X | Blocked: %d", self.selectedPacket, self.blockedCount) self.statusLabel.TextColor3 = Color3.fromRGB(255, 100, 100) else self.statusLabel.Text = string.format("Status: Idle (0x%02X)", self.selectedPacket) self.statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100) end end function PacketBlocker:registerHooks() local raknetLibrary = raknet or (getgenv and getgenv().raknet) or (_G and _G.raknet) if raknetLibrary and typeof(raknetLibrary.add_send_hook) == "function" then self.activeHook = function(packet) if not self or not self.screenGui then return end if packet and packet.PacketId then if self.isBlocking and packet.PacketId == self.selectedPacket then if typeof(packet.Block) == "function" then packet:Block() end self.blockedCount = self.blockedCount + 1 self:updateStatus() return end self:recordPacket(packet.PacketId) end end raknetLibrary.add_send_hook(self.activeHook) self.statusLabel.Text = "Status: RakNet Hook Active" self.statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100) else self.statusLabel.Text = "Status: RakNet Library Not Found" self.statusLabel.TextColor3 = Color3.fromRGB(255, 100, 100) end end function PacketBlocker:toggle() self.screenGui.Enabled = not self.screenGui.Enabled end function PacketBlocker:destroy() self.isBlocking = false local raknetLibrary = raknet or (getgenv and getgenv().raknet) or (_G and _G.raknet) if raknetLibrary and typeof(raknetLibrary.remove_send_hook) == "function" and self.activeHook then pcall(function() raknetLibrary.remove_send_hook(self.activeHook) end) end self.activeHook = nil if self.connections then for _, connection in ipairs(self.connections) do if connection and connection.Connected then connection:Disconnect() end end table.clear(self.connections) self.connections = nil end if self.logEntries then for _, entry in pairs(self.logEntries) do if entry then entry:Destroy() end end table.clear(self.logEntries) self.logEntries = nil end if self.logWindow then self.logWindow:Destroy() self.logWindow = nil end if self.screenGui then self.screenGui:Destroy() self.screenGui = nil end if self.packetCounts then table.clear(self.packetCounts) self.packetCounts = nil end setmetatable(self, nil) end local packetBlockerInstance = PacketBlocker.new() local toggleConnection = UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if HideKey~="" and input.KeyCode == Enum.KeyCode[HideKey] then packetBlockerInstance:toggle() elseif BlockKey~="" and input.KeyCode == Enum.KeyCode[BlockKey] then packetBlockerInstance:toggleBlock() end end) table.insert(packetBlockerInstance.connections, toggleConnection)