Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loadstring([[
- local plr = game.Players.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- local hrp = char:WaitForChild("HumanoidRootPart")
- -- GUI Setup
- local gui = Instance.new("ScreenGui", plr:WaitForChild("PlayerGui"))
- gui.Name = "AntiSlapCustomGUI"
- gui.ResetOnSpawn = false
- -- Main Frame
- local frame = Instance.new("Frame", gui)
- frame.Size = UDim2.new(0, 220, 0, 70)
- frame.Position = UDim2.new(0.5, -110, 0.2, 0)
- frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- frame.BorderSizePixel = 0
- frame.Active = true
- frame.Draggable = false -- Use custom drag code
- local corner = Instance.new("UICorner", frame)
- corner.CornerRadius = UDim.new(0, 12)
- local title = Instance.new("TextLabel", frame)
- title.Size = UDim2.new(1, 0, 0.4, 0)
- title.Position = UDim2.new(0, 0, 0, 0)
- title.BackgroundTransparency = 1
- title.Text = "🛡️ Anti Slap GUI"
- title.TextColor3 = Color3.new(1, 1, 1)
- title.Font = Enum.Font.GothamBold
- title.TextSize = 18
- local button = Instance.new("TextButton", frame)
- button.Size = UDim2.new(0.9, 0, 0.4, 0)
- button.Position = UDim2.new(0.05, 0, 0.5, 0)
- button.BackgroundColor3 = Color3.fromRGB(200, 30, 30)
- button.TextColor3 = Color3.new(1, 1, 1)
- button.Font = Enum.Font.GothamBold
- button.TextSize = 16
- button.Text = "Anti Slap: OFF"
- local buttonCorner = Instance.new("UICorner", button)
- buttonCorner.CornerRadius = UDim.new(0, 8)
- -- Draggable Handler
- local dragging = false
- local dragStart, startPos
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- game:GetService("UserInputService").InputChanged:Connect(function(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(
- startPos.X.Scale,
- startPos.X.Offset + delta.X,
- startPos.Y.Scale,
- startPos.Y.Offset + delta.Y
- )
- end
- end)
- -- Notification function
- local function notify(txt)
- local n = Instance.new("TextLabel", gui)
- n.Size = UDim2.new(0, 250, 0, 40)
- n.Position = UDim2.new(0.5, -125, 0.35, 0)
- n.BackgroundColor3 = Color3.fromRGB(0, 120, 255)
- n.TextColor3 = Color3.new(1, 1, 1)
- n.Font = Enum.Font.GothamBold
- n.TextSize = 18
- n.Text = txt
- n.BackgroundTransparency = 0.1
- n.BorderSizePixel = 0
- local c = Instance.new("UICorner", n)
- c.CornerRadius = UDim.new(0, 10)
- game:GetService("TweenService"):Create(n, TweenInfo.new(0.4), {TextTransparency = 0}):Play()
- task.wait(2)
- game:GetService("TweenService"):Create(n, TweenInfo.new(0.4), {TextTransparency = 1}):Play()
- task.wait(0.5)
- n:Destroy()
- end
- -- Anti Slap Logic
- local antiSlap = false
- local connection
- local lastPosition
- local function enableAntiSlap()
- if connection then connection:Disconnect() end
- connection = game:GetService("RunService").Heartbeat:Connect(function()
- if not char or not char:FindFirstChild("HumanoidRootPart") then return end
- local hum = char:FindFirstChild("Humanoid")
- local hrp = char:FindFirstChild("HumanoidRootPart")
- if hum and hum:GetState() ~= Enum.HumanoidStateType.PlatformStanding then
- lastPosition = hrp.CFrame
- end
- for _, v in pairs(char:GetDescendants()) do
- if v:IsA("BodyVelocity") or v:IsA("BodyAngularVelocity") or v.Name:lower():find("ragdoll") then
- v:Destroy()
- if lastPosition then
- hrp.CFrame = lastPosition
- notify("Slap Blocked!")
- end
- end
- end
- if hum and hum:GetState() == Enum.HumanoidStateType.PlatformStanding then
- hum:ChangeState(Enum.HumanoidStateType.GettingUp)
- hum.PlatformStand = false
- if lastPosition then
- hrp.CFrame = lastPosition
- end
- notify("Recovered from push!")
- end
- end)
- end
- local function disableAntiSlap()
- if connection then connection:Disconnect() end
- end
- button.MouseButton1Click:Connect(function()
- antiSlap = not antiSlap
- button.Text = "Anti Slap: " .. (antiSlap and "ON" or "OFF")
- button.BackgroundColor3 = antiSlap and Color3.fromRGB(30, 200, 70) or Color3.fromRGB(200, 30, 30)
- if antiSlap then
- enableAntiSlap()
- else
- disableAntiSlap()
- end
- end)
- plr.CharacterAdded:Connect(function(c)
- char = c
- task.wait(1)
- hrp = char:WaitForChild("HumanoidRootPart")
- if antiSlap then enableAntiSlap() end
- end)
- -- New toggle button for showing/hiding the main frame
- local toggleBtn = Instance.new("TextButton", gui)
- toggleBtn.Size = UDim2.new(0, 40, 0, 40)
- toggleBtn.Position = UDim2.new(0, 10, 0, 10) -- Top-left corner with some padding
- toggleBtn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- toggleBtn.TextColor3 = Color3.new(1, 1, 1)
- toggleBtn.Font = Enum.Font.GothamBold
- toggleBtn.TextSize = 24
- toggleBtn.Text = "☰" -- Hamburger menu icon
- local toggleCorner = Instance.new("UICorner", toggleBtn)
- toggleCorner.CornerRadius = UDim.new(0, 8)
- toggleBtn.MouseButton1Click:Connect(function()
- if frame.Visible then
- frame.Visible = false
- toggleBtn.Text = "▶" -- Arrow icon when hidden
- else
- frame.Visible = true
- toggleBtn.Text = "☰"
- end
- end)
- ]])()
Advertisement
Add Comment
Please, Sign In to add comment