Advertisement
FulsakenS

Utmm Script kill npc using aura (Rework new)

Jul 4th, 2024
2,801
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | Gaming | 0 0
  1. local enabled = false
  2. local textButton
  3.  
  4. local function executeScript()
  5. getgenv().G = true
  6. getgenv().Creator = 'https://discord.gg/B3HqPPzFYr - HalloweenGaster'
  7.  
  8. sethiddenproperty(game.Players.LocalPlayer, "SimulationRadius", 112412400000)
  9. sethiddenproperty(game.Players.LocalPlayer, "MaxSimulationRadius", 112412400000)
  10.  
  11. for _, d in pairs(game.Workspace:GetDescendants()) do
  12. if d.ClassName == 'Humanoid' and not game.Players:GetPlayerFromCharacter(d.Parent) then
  13. d.Health = 0
  14. end
  15. end
  16. end
  17.  
  18. local function checkForNearbyNPCs()
  19. local player = game.Players.LocalPlayer
  20. local character = player.Character or player.CharacterAdded:Wait()
  21. local rootPart = character:WaitForChild("HumanoidRootPart")
  22.  
  23. for _, npc in pairs(game.Workspace:GetDescendants()) do
  24. if npc:IsA("Model") and npc:FindFirstChild("Humanoid") and npc ~= character then
  25. local npcRootPart = npc:FindFirstChild("HumanoidRootPart")
  26. if npcRootPart then
  27. local distance = (npcRootPart.Position - rootPart.Position).Magnitude
  28. if distance <= 25 then
  29. executeScript()
  30. break
  31. end
  32. end
  33. end
  34. end
  35. end
  36.  
  37. local function createToggleButton()
  38. local ScreenGui = Instance.new("ScreenGui")
  39. local TextButton = Instance.new("TextButton")
  40. local UIScale = Instance.new("UIScale")
  41. local UIStroke = Instance.new("UIStroke")
  42.  
  43. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  44.  
  45. TextButton.Parent = ScreenGui
  46. TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  47. TextButton.Position = UDim2.new(0, 10, 0.5, -20)
  48. TextButton.Size = UDim2.new(0, 100, 0, 40) -- Smaller size for the button
  49. TextButton.Font = Enum.Font.SourceSans
  50. TextButton.Text = "NPC Check OFF"
  51. TextButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  52. TextButton.TextSize = 18
  53. TextButton.TextStrokeTransparency = 0 -- Ensure text stroke is visible
  54.  
  55. UIScale.Parent = TextButton
  56. UIScale.Scale = 1 -- Default scale, can be adjusted if needed
  57.  
  58. UIStroke.Parent = TextButton
  59. UIStroke.Thickness = 2 -- Border thickness
  60. UIStroke.Color = Color3.fromRGB(0, 0, 0) -- Border color
  61. UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border -- Apply stroke to the border
  62.  
  63. textButton = TextButton -- Save a reference to the button for later
  64.  
  65. TextButton.MouseButton1Click:Connect(function()
  66. enabled = not enabled
  67. TextButton.Text = enabled and "NPC Check ON" or "NPC Check OFF"
  68. end)
  69.  
  70. -- Make the TextButton draggable
  71. local dragging = false
  72. local dragInput, dragStart, startPos
  73.  
  74. local function updateDrag(input)
  75. local delta = input.Position - dragStart
  76. TextButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  77. end
  78.  
  79. TextButton.InputBegan:Connect(function(input)
  80. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  81. dragging = true
  82. dragStart = input.Position
  83. startPos = TextButton.Position
  84.  
  85. input.Changed:Connect(function()
  86. if input.UserInputState == Enum.UserInputState.End then
  87. dragging = false
  88. end
  89. end)
  90. end
  91. end)
  92.  
  93. TextButton.InputChanged:Connect(function(input)
  94. if input.UserInputType == Enum.UserInputType.MouseMovement then
  95. if dragging then
  96. updateDrag(input)
  97. end
  98. end
  99. end)
  100. end
  101.  
  102. local function startChecking()
  103. while true do
  104. if enabled then
  105. checkForNearbyNPCs()
  106. end
  107. wait(0.5) -- Delay for 0.5 second
  108. end
  109. end
  110.  
  111. local function onPlayerCharacterAdded()
  112. -- Remove the old button if it exists
  113. if textButton and textButton.Parent then
  114. textButton.Parent:Destroy()
  115. end
  116.  
  117. -- Create the toggle button again
  118. createToggleButton()
  119. end
  120.  
  121. -- Create the toggle button initially
  122. createToggleButton()
  123.  
  124. -- Start the check loop with a delay
  125. spawn(startChecking)
  126.  
  127. -- Recreate the toggle button when the player respawns
  128. game.Players.LocalPlayer.CharacterAdded:Connect(onPlayerCharacterAdded)
Tags: UTMM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement