Advertisement
ustinjamesss

screeepttsss

May 26th, 2023
2,718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. getgenv().killmobs = true-- Decides whether or not to kill mobs
  2. getgenv().mineores = true -- Decides whether or not to mine ores
  3.  
  4. -- Auto Toggler --
  5. getgenv().on = not on -- Toggles the state of the script, unless for whatever reason you need to manually change the script state, no need to edit this.
  6.  
  7. -- Kill function --
  8. function Kill(hum, isore)
  9. local wep =
  10. (isore and game:GetService("Players").LocalPlayer.Backpack:FindFirstChild("Scrap Pickaxe")) or
  11. game:GetService("Players").LocalPlayer.Backpack:FindFirstChild("Sword")
  12. -- Above line decides whether to use the pickaxe (if it is an ore) or to use the sword if it isn't.
  13. local args = {
  14. [1] = "hit", -- Tells the remote that we want to hit something
  15. [2] = {
  16. [1] = hum, -- The humanoid we want to hit
  17. [2] = hum.MaxHealth * 10 -- The damage we deal. It is 10 times their max health to be safe.
  18. }
  19. }
  20. wep.RemoteFunction:InvokeServer(unpack(args)) -- Fire the remote with the arguments
  21. end
  22.  
  23. -- The actual killing --
  24. while on and task.wait() do
  25. local success, error = pcall(function()
  26. if killmobs then -- If killing mobs is toggled on
  27. for _, v in pairs(workspace:GetChildren()) do
  28. if
  29. v:FindFirstChildOfClass("Humanoid") and v.Name ~= "DPS Tester" and
  30. not game.Players:GetPlayerFromCharacter(v) and
  31. v ~= nil
  32. then
  33. -- Above line checks that it is a Humanoid, that it isn't the DPS Tester dummy, and that it isn't a player
  34. Kill(v:FindFirstChildOfClass("Humanoid"), false) -- Calls kill function on it, and tells the function that it isn't an ore
  35. end
  36. end
  37. end
  38. if mineores then -- If mining ores is toggled on
  39. for _, v in pairs(workspace.SpawnedOres:GetChildren()) do
  40. if v:FindFirstChildOfClass("Humanoid") and v ~= nil then -- Checks to make sure it has a humanoid
  41. Kill(v:FindFirstChildOfClass("Humanoid"), true) -- Calls kill function on the ore, and tells the function that it is an ore
  42. end
  43. end
  44. end
  45. end)
  46. if not success then
  47. warn("Script error:", error)
  48. end
  49. end
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement