Advertisement
CaliberMag

Untitled

Nov 8th, 2020 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3. local TweenService = game:GetService("TweenService")
  4. local Player = game:GetService("Players").LocalPlayer
  5.  
  6. warn("~ Praise le vleen! ~")
  7.  
  8. local FoundEnemy = false
  9.  
  10. local function TweenHandler(TargetPart)
  11. local tweenInfo = TweenInfo.new(((TargetPart.Position - Player.Character.Head.Position).magnitude / (4 * 10)))
  12. local Tween = TweenService:Create(Player.Character.HumanoidRootPart, tweenInfo, {CFrame = CFrame.new(TargetPart.Position.x, TargetPart.Position.y, TargetPart.Position.z)})
  13. Tween:Play()
  14. return Tween
  15. end
  16.  
  17. local function GetQuest(Name)
  18. local QuestInfo = {
  19. ["Village Bandit"] = {
  20. ["Arguments"] = {["Type"] = "Quest", ["NPCName"] = "Level1Quest", ["ID"] = "Level1Quest", ["Description"] = "Kill 10 Weak Bandits!", ["Job"] = "AcceptDialogue"};
  21. ["Quest"] = "Level1Quest"
  22. };
  23. ["Bandit Assassin"] = {
  24. ["Arguments"] = {["Type"] = "Quest", ["NPCName"] = "Level12Quest", ["ID"] = "Level12Quest", ["Description"] = "Wack 10 pirate assassins for me mate!", ["Job"] = "AcceptDialogue"};
  25. ["Quest"] = "Level12Quest"
  26. };
  27. ["Bandit Leader"] = {
  28. ["Arguments"] = {["Type"] = "Quest", ["NPCName"] = "Level18Quest", ["ID"] = "Level18Quest", ["Description"] = "show bandit leader whos the boss", ["Job"] = "AcceptDialogue"};
  29. ["Quest"] = "Level18Quest"
  30. };
  31.  
  32. }
  33. if not Player.PlayerValues.Quests:FindFirstChild(QuestInfo[Name]["Quest"]) then
  34. ReplicatedStorage.Remotes.ClientE:FireServer(QuestInfo[Name]["Arguments"])
  35. end
  36. end
  37.  
  38. local function Lock(Target)
  39. if Loop then
  40. Loop:Disconnect()
  41. end
  42. local LastTime = 0
  43. Loop = RunService.Heartbeat:Connect(function()
  44. if tick() - LastTime >= 0.1 then
  45. LastTime = tick()
  46. if _G.Enabled == false then
  47. Loop:Disconnect()
  48. FoundEnemy = false
  49. end
  50. if not Target then
  51. Loop:Disconnect()
  52. wait(1)
  53. FoundEnemy = false
  54. end
  55. if Target.Parent.Humanoid.Health <= 0 then
  56. Loop:Disconnect()
  57. wait(1)
  58. FoundEnemy = false
  59. end
  60. if Player.Character.Humanoid.Health <= 0 then
  61. Loop:Disconnect()
  62. wait(3)
  63. FoundEnemy = false
  64. end
  65. if not Player.Character:FindFirstChild(_G.Weapon) then
  66. Player.Character.Humanoid:EquipTool(Player.Backpack[_G.Weapon])
  67. end
  68.  
  69. Player.Character[_G.Weapon]:Activate()
  70. Player.Character.HumanoidRootPart.CFrame = Target.CFrame + Target.CFrame.LookVector * -4
  71. end
  72. end)
  73. end
  74.  
  75. coroutine.resume(coroutine.create(function()
  76. if _G.Enabled == true then
  77. repeat wait(1)
  78. if FoundEnemy == false then
  79. for _, v in pairs(workspace.Enemies:GetChildren()) do
  80. if table.find(_G.NpcName, v.Name) and v:FindFirstChild("HumanoidRootPart") and (v.HumanoidRootPart.Position - Player.Character.HumanoidRootPart.Position).Magnitude <= 1000 then
  81. FoundEnemy = true
  82. GetQuest(v.Name)
  83.  
  84. local Tween = TweenHandler(v.HumanoidRootPart)
  85. Completion = Tween.Completed:Connect(function()
  86. Completion:Disconnect()
  87. Tween:Destroy()
  88. Lock(v.HumanoidRootPart)
  89. end)
  90. break
  91. end
  92. end
  93. end
  94. until _G.Enabled == false
  95. end
  96. end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement