Advertisement
mjv2023

BAN HAMMER SCRIPT

Aug 7th, 2023 (edited)
4,155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | Gaming | 1 1
  1. --this script is by susmic123_real-
  2. local banHammer = Instance.new("Tool")
  3. banHammer.Name = "BanHammer"
  4.  
  5. -- Define a function to ban a player
  6. local function banPlayer(player)
  7.     -- Insert your ban logic here (e.g., kick or remove them from the game)
  8.     print("Banning player: " .. player.Name)
  9.     player:Kick("You have been banned by an admin.")
  10. end
  11.  
  12. -- Define what happens when the tool is activated
  13. banHammer.Activated:Connect(function()
  14.     local character = game.Players.LocalPlayer.Character
  15.     local humanoid = character:FindFirstChild("Humanoid")
  16.     local mouse = game.Players.LocalPlayer:GetMouse()
  17.  
  18.     if humanoid and humanoid.Health > 0 then
  19.         local target = mouse.Target
  20.         if target and target.Parent:FindFirstChild("Humanoid") then
  21.             local targetHumanoid = target.Parent:FindFirstChild("Humanoid")
  22.             local targetPlayer = game.Players:GetPlayerFromCharacter(target.Parent)
  23.            
  24.             if targetPlayer then
  25.                 banPlayer(targetPlayer)
  26.             end
  27.         end
  28.     end
  29. end)
  30.  
  31. -- Add the Ban Hammer tool to the player's Backpack
  32. game.Players.LocalPlayer.Backpack:WaitForChild("BanHammer")
  33. banHammer.Parent = game.Players.LocalPlayer.Backpack
Tags: ban hammer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement