Algarnr

New scripter

Jun 9th, 2025
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.19 KB | Source Code | 0 0
  1. loadstring([[
  2. local plr = game.Players.LocalPlayer
  3. local char = plr.Character or plr.CharacterAdded:Wait()
  4. local hrp = char:WaitForChild("HumanoidRootPart")
  5.  
  6. -- GUI Setup
  7. local gui = Instance.new("ScreenGui", plr:WaitForChild("PlayerGui"))
  8. gui.Name = "AntiSlapCustomGUI"
  9. gui.ResetOnSpawn = false
  10.  
  11. -- Main Frame
  12. local frame = Instance.new("Frame", gui)
  13. frame.Size = UDim2.new(0, 220, 0, 70)
  14. frame.Position = UDim2.new(0.5, -110, 0.2, 0)
  15. frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  16. frame.BorderSizePixel = 0
  17. frame.Active = true
  18. frame.Draggable = false -- Use custom drag code
  19.  
  20. local corner = Instance.new("UICorner", frame)
  21. corner.CornerRadius = UDim.new(0, 12)
  22.  
  23. local title = Instance.new("TextLabel", frame)
  24. title.Size = UDim2.new(1, 0, 0.4, 0)
  25. title.Position = UDim2.new(0, 0, 0, 0)
  26. title.BackgroundTransparency = 1
  27. title.Text = "🛡️ Anti Slap GUI"
  28. title.TextColor3 = Color3.new(1, 1, 1)
  29. title.Font = Enum.Font.GothamBold
  30. title.TextSize = 18
  31.  
  32. local button = Instance.new("TextButton", frame)
  33. button.Size = UDim2.new(0.9, 0, 0.4, 0)
  34. button.Position = UDim2.new(0.05, 0, 0.5, 0)
  35. button.BackgroundColor3 = Color3.fromRGB(200, 30, 30)
  36. button.TextColor3 = Color3.new(1, 1, 1)
  37. button.Font = Enum.Font.GothamBold
  38. button.TextSize = 16
  39. button.Text = "Anti Slap: OFF"
  40. local buttonCorner = Instance.new("UICorner", button)
  41. buttonCorner.CornerRadius = UDim.new(0, 8)
  42.  
  43. -- Draggable Handler
  44. local dragging = false
  45. local dragStart, startPos
  46.  
  47. frame.InputBegan:Connect(function(input)
  48.     if input.UserInputType == Enum.UserInputType.MouseButton1 then
  49.         dragging = true
  50.         dragStart = input.Position
  51.         startPos = frame.Position
  52.  
  53.         input.Changed:Connect(function()
  54.             if input.UserInputState == Enum.UserInputState.End then
  55.                 dragging = false
  56.             end
  57.         end)
  58.     end
  59. end)
  60.  
  61. game:GetService("UserInputService").InputChanged:Connect(function(input)
  62.     if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  63.         local delta = input.Position - dragStart
  64.         frame.Position = UDim2.new(
  65.             startPos.X.Scale,
  66.             startPos.X.Offset + delta.X,
  67.             startPos.Y.Scale,
  68.             startPos.Y.Offset + delta.Y
  69.         )
  70.     end
  71. end)
  72.  
  73. -- Notification function
  74. local function notify(txt)
  75.     local n = Instance.new("TextLabel", gui)
  76.     n.Size = UDim2.new(0, 250, 0, 40)
  77.     n.Position = UDim2.new(0.5, -125, 0.35, 0)
  78.     n.BackgroundColor3 = Color3.fromRGB(0, 120, 255)
  79.     n.TextColor3 = Color3.new(1, 1, 1)
  80.     n.Font = Enum.Font.GothamBold
  81.     n.TextSize = 18
  82.     n.Text = txt
  83.     n.BackgroundTransparency = 0.1
  84.     n.BorderSizePixel = 0
  85.     local c = Instance.new("UICorner", n)
  86.     c.CornerRadius = UDim.new(0, 10)
  87.  
  88.     game:GetService("TweenService"):Create(n, TweenInfo.new(0.4), {TextTransparency = 0}):Play()
  89.     task.wait(2)
  90.     game:GetService("TweenService"):Create(n, TweenInfo.new(0.4), {TextTransparency = 1}):Play()
  91.     task.wait(0.5)
  92.     n:Destroy()
  93. end
  94.  
  95. -- Anti Slap Logic
  96. local antiSlap = false
  97. local connection
  98. local lastPosition
  99.  
  100. local function enableAntiSlap()
  101.     if connection then connection:Disconnect() end
  102.     connection = game:GetService("RunService").Heartbeat:Connect(function()
  103.         if not char or not char:FindFirstChild("HumanoidRootPart") then return end
  104.         local hum = char:FindFirstChild("Humanoid")
  105.         local hrp = char:FindFirstChild("HumanoidRootPart")
  106.  
  107.         if hum and hum:GetState() ~= Enum.HumanoidStateType.PlatformStanding then
  108.             lastPosition = hrp.CFrame
  109.         end
  110.  
  111.         for _, v in pairs(char:GetDescendants()) do
  112.             if v:IsA("BodyVelocity") or v:IsA("BodyAngularVelocity") or v.Name:lower():find("ragdoll") then
  113.                 v:Destroy()
  114.                 if lastPosition then
  115.                     hrp.CFrame = lastPosition
  116.                     notify("Slap Blocked!")
  117.                 end
  118.             end
  119.         end
  120.  
  121.         if hum and hum:GetState() == Enum.HumanoidStateType.PlatformStanding then
  122.             hum:ChangeState(Enum.HumanoidStateType.GettingUp)
  123.             hum.PlatformStand = false
  124.             if lastPosition then
  125.                 hrp.CFrame = lastPosition
  126.             end
  127.             notify("Recovered from push!")
  128.         end
  129.     end)
  130. end
  131.  
  132. local function disableAntiSlap()
  133.     if connection then connection:Disconnect() end
  134. end
  135.  
  136. button.MouseButton1Click:Connect(function()
  137.     antiSlap = not antiSlap
  138.     button.Text = "Anti Slap: " .. (antiSlap and "ON" or "OFF")
  139.     button.BackgroundColor3 = antiSlap and Color3.fromRGB(30, 200, 70) or Color3.fromRGB(200, 30, 30)
  140.     if antiSlap then
  141.         enableAntiSlap()
  142.     else
  143.         disableAntiSlap()
  144.     end
  145. end)
  146.  
  147. plr.CharacterAdded:Connect(function(c)
  148.     char = c
  149.     task.wait(1)
  150.     hrp = char:WaitForChild("HumanoidRootPart")
  151.     if antiSlap then enableAntiSlap() end
  152. end)
  153.  
  154. -- New toggle button for showing/hiding the main frame
  155. local toggleBtn = Instance.new("TextButton", gui)
  156. toggleBtn.Size = UDim2.new(0, 40, 0, 40)
  157. toggleBtn.Position = UDim2.new(0, 10, 0, 10) -- Top-left corner with some padding
  158. toggleBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  159. toggleBtn.TextColor3 = Color3.new(1, 1, 1)
  160. toggleBtn.Font = Enum.Font.GothamBold
  161. toggleBtn.TextSize = 24
  162. toggleBtn.Text = "☰" -- Hamburger menu icon
  163. local toggleCorner = Instance.new("UICorner", toggleBtn)
  164. toggleCorner.CornerRadius = UDim.new(0, 8)
  165.  
  166. toggleBtn.MouseButton1Click:Connect(function()
  167.     if frame.Visible then
  168.         frame.Visible = false
  169.         toggleBtn.Text = "▶" -- Arrow icon when hidden
  170.     else
  171.         frame.Visible = true
  172.         toggleBtn.Text = "☰"
  173.     end
  174. end)
  175. ]])()
  176.  
Tags: #none
Advertisement
Add Comment
Please, Sign In to add comment