Advertisement
RandomMagics

Blade Quest script

Jan 17th, 2022
2,849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. -- Put the world settings here
  2. getgenv().client = {
  3. settings = {
  4. below = true, -- True for teleporting below the mob, false for above the mob. Both modes are useful depending on the level
  5. offset = 6, -- Teleport offset. Recommend putting this at 5 - 8
  6. teleportspeed = 125, -- Dynamic teleport speed. I recommend putting this anywhere from 125 - 150
  7. },
  8. autoplay = {
  9. world = "Forest",
  10. difficulty = "Expert",
  11. friendsonly = true,
  12. hardcore = true,
  13. }
  14. }
  15.  
  16.  
  17. repeat wait() until game:IsLoaded() -- allows the script to be placed in auto execute
  18.  
  19. wait(3)
  20.  
  21. -- Lobby check
  22. for i, v in pairs(workspace.Enemies:GetChildren()) do
  23. if (v.Name == "Dummy") then
  24. game:GetService("ReplicatedStorage").RF:InvokeServer("Create", getgenv().client.autoplay.world, getgenv().client.autoplay.difficulty, getgenv().client.autoplay.friendsonly, getgenv().client.autoplay.hardcore)
  25. game:GetService("ReplicatedStorage").RF:InvokeServer("Start")
  26. end
  27. end
  28.  
  29. -- Player
  30. local Plr = game.Players.LocalPlayer
  31. local Char = Plr.Character
  32. local RootPart = Char.HumanoidRootPart
  33.  
  34. -- Tween service
  35. local TweenService = game:GetService("TweenService")
  36. local RunService = game:GetService("RunService")
  37.  
  38. -- Body Force/No Gravity
  39. local bv = Instance.new("BodyVelocity")
  40. bv.Velocity = Vector3.new(0, 0, 0)
  41. bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  42. bv.P = 9000
  43. bv.Parent = RootPart
  44.  
  45. -- Main auto farm
  46. RunService.Heartbeat:Connect(function()
  47. local Origin = RootPart.Position
  48. local Target, Closest = nil, math.huge
  49.  
  50. for i, v in pairs(workspace.Enemies:GetChildren()) do
  51. repeat wait() until (v.HumanoidRootPart and RootPart ~= nil)
  52.  
  53. if (v ~= nil and v.Name ~= "Dummy" and v.Enemy.Health > 0) then
  54. if (v:FindFirstChild("HumanoidRootPart")) then
  55. local dist = (Origin - v.HumanoidRootPart.Position).Magnitude
  56.  
  57. if (dist < Closest) then
  58. Closest = dist
  59. Target = v
  60. end
  61. end
  62. end
  63. end
  64.  
  65.  
  66. if (Target) then
  67. local Pos = Target.HumanoidRootPart.Position
  68.  
  69. local TweenInfo = TweenInfo.new(math.round((Target.HumanoidRootPart.Position - workspace.CurrentCamera.CFrame.p).Magnitude) / getgenv().client.settings.teleportspeed, Enum.EasingStyle.Linear)
  70.  
  71. Char.Humanoid:ChangeState(10)
  72.  
  73. if (Target.HumanoidRootPart and RootPart ~= nil) then
  74. local Tp = TweenService:Create(RootPart, TweenInfo, {
  75. CFrame = CFrame.new(Vector3.new(Pos.X, Pos.Y - getgenv().client.settings.offset, Pos.Z))
  76. })
  77.  
  78. local Tp2 = TweenService:Create(RootPart, TweenInfo, {
  79. CFrame = CFrame.new(Vector3.new(Pos.X, Pos.Y + getgenv().client.settings.offset, Pos.Z))
  80. })
  81.  
  82. if (getgenv().client.settings.below) then
  83. Tp:Play()
  84. else
  85. Tp2:Play()
  86. end
  87.  
  88. if (Target:FindFirstChildOfClass("Humanoid")) then
  89. if (Target.Enemy.Health ~= 0) then
  90. game.ReplicatedStorage.RE:FireServer("Hit", Target, Target.HumanoidRootPart.Position, Target.HumanoidRootPart.Position)
  91.  
  92. game:GetService("ReplicatedStorage").Magic:FireServer("Damage")
  93. game:GetService("ReplicatedStorage").Magic:FireServer("Support")
  94.  
  95. elseif (Target.Enemy.Health == 0) then
  96. Target:Destroy()
  97. end
  98. end
  99. end
  100. end
  101. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement