Advertisement
MachineFox

Antifling script

Feb 7th, 2025 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.53 KB | Source Code | 0 0
  1. -- Criação do GUI
  2.  
  3. local player = game.Players.LocalPlayer
  4. local playerGui = player:WaitForChild("PlayerGui")
  5. local screenGui = Instance.new("ScreenGui")
  6. local toggleButton = Instance.new("TextButton")
  7.  
  8. screenGui.Name = "AntiFlingGui"
  9. screenGui.ResetOnSpawn = false -- Garantir que o GUI não desapareça ao morrer
  10. screenGui.Parent = playerGui
  11.  
  12. toggleButton.Size = UDim2.new(0, 50, 0, 50) -- Botão pequeno e redondo
  13. toggleButton.Position = UDim2.new(0.5, -25, 0, -30) -- Posição um pouco mais para cima
  14. toggleButton.Text = "+"
  15. toggleButton.Parent = screenGui
  16. toggleButton.BackgroundColor3 = Color3.new(0, 0, 0) -- Cor preta
  17. toggleButton.BorderSizePixel = 0
  18. toggleButton.TextScaled = true
  19. toggleButton.TextColor3 = Color3.new(1, 1, 1) -- Cor do texto branco
  20. toggleButton.Font = Enum.Font.SourceSansBold
  21. toggleButton.TextSize = 24
  22.  
  23. -- Torna o botão redondo
  24. local uICorner = Instance.new("UICorner")
  25. uICorner.CornerRadius = UDim.new(0.5, 0)
  26. uICorner.Parent = toggleButton
  27.  
  28. -- Lógica de colisão
  29. local collisionEnabled = true
  30.  
  31. local function setCollisionEnabled(character, enabled)
  32.     for _, part in pairs(character:GetChildren()) do
  33.         if part:IsA("BasePart") then
  34.             part.CanCollide = enabled
  35.         end
  36.     end
  37. end
  38.  
  39. local function disableCollisionContinuously()
  40.     while wait(0.05) do
  41.         if not collisionEnabled then
  42.             for _, otherPlayer in pairs(game.Players:GetPlayers()) do
  43.                 if otherPlayer ~= player then
  44.                     local character = otherPlayer.Character
  45.                     if character then
  46.                         setCollisionEnabled(character, false)
  47.                     end
  48.                 end
  49.             end
  50.         end
  51.     end
  52. end
  53.  
  54. toggleButton.MouseButton1Click:Connect(function()
  55.     collisionEnabled = not collisionEnabled
  56.     if collisionEnabled then
  57.         toggleButton.Text = "+"
  58.         toggleButton.BackgroundColor3 = Color3.new(0, 0, 0) -- Preto para indicar ativado
  59.  
  60.         -- Reativar colisão
  61.         for _, otherPlayer in pairs(game.Players:GetPlayers()) do
  62.             if otherPlayer ~= player then
  63.                 local character = otherPlayer.Character
  64.                 if character then
  65.                     setCollisionEnabled(character, true)
  66.                 end
  67.             end
  68.         end
  69.     else
  70.         toggleButton.Text = "-"
  71.         toggleButton.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5) -- Cinza para indicar desativado
  72.     end
  73. end)
  74.  
  75. game:GetService("RunService").Stepped:Connect(disableCollisionContinuously)
  76.  
Tags: Script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement