Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _G.Toggle = true
- _G.DipOnLowHealth = true
- _G.PrefferedInnKeeper = "Keeper"
- -- ^ don't use this for now
- _G.MaxDistance = 2500 -- change this variable to the max distance the character can venture to the mob to slay it
- local vu = game:GetService("VirtualUser")
- game:GetService("Players").LocalPlayer.Idled:Connect(function()
- vu:Button2Down(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
- wait(1)
- vu:Button2Up(Vector2.new(0,0),workspace.CurrentCamera.CFrame)
- end)
- local Events = game.ReplicatedStorage.Events
- local Keeper = workspace.NPCS.Keeper
- local Heal = game.Players.LocalPlayer.PlayerGui.CoreGUI.Events.DialogEffect
- local Sleep = Keeper.ChatInfo.Chats.Sleep
- local AttackEvent = Events.Event1
- local NPCs = workspace.NPCS
- local Player = game.Players.LocalPlayer
- local Character = Player.Character
- local HRP = Character.HumanoidRootPart
- local PlayerHum = Character.Humanoid
- local TweenService = game:GetService("TweenService")
- local SpawnLocation = Keeper.CFrame * CFrame.new(2, 0, 0)
- Player.CharacterAdded:Connect(function(char)
- HRP = char:WaitForChild("HumanoidRootPart")
- PlayerHum = char:WaitForChild("Humanoid")
- end)
- local Mobs = {
- "Buni", "DireBuni", "Bumblz", "Budboy", "Drone", "Woof", "WinterWoof"
- }
- local AllowedTools = {
- "BasicSword", "LongSword", "SharpSword", "ManaSword", "GreatSword", "Dagger"
- }
- while wait() do
- PlayerHum:ChangeState(11)
- if _G.Toggle == false then
- PlayerHum:ChangeState(7)
- break
- end
- for _, v in pairs(NPCs:GetChildren()) do
- if table.find(Mobs, v.Name) then
- for i = 1, 1000 do
- if _G.Toggle == false then
- PlayerHum:ChangeState(7)
- break
- end
- local ActualNPC = v:FindFirstChild(v.Name)
- for _, v in pairs(Player.Character:GetChildren()) do
- if table.find(AllowedTools, v.Name) then
- break
- else
- for _, v in pairs(Player.Backpack:GetChildren()) do
- if table.find(AllowedTools, v.Name) then
- PlayerHum:EquipTool(v)
- break
- end
- end
- end
- end
- if ActualNPC then
- local Humanoid = ActualNPC:FindFirstChild("Humanoid")
- if not Humanoid or not ActualNPC:FindFirstChild("HumanoidRootPart") then break end
- repeat wait() until HRP
- repeat wait() until HRP.Anchored == false
- if Humanoid.Health <= 0 then break end
- if _G.DipOnLowHealth == true then
- if PlayerHum.Health / PlayerHum.MaxHealth <= 0.15 then
- local dist = (SpawnLocation.Position - HRP.Position).Magnitude
- local velocity = 160
- local info = TweenInfo.new(dist / velocity, Enum.EasingStyle.Linear)
- local g = {}
- g.CFrame = SpawnLocation
- local Tween = TweenService:Create(HRP, info, g)
- Tween:Play()
- Tween.Completed:Wait()
- Heal:InvokeServer(workspace.NPCS.Keeper, Sleep)
- end
- end
- local dist = (v.Position - HRP.Position).Magnitude
- if dist > _G.MaxDistance then break end
- local velocity = 160
- local info = TweenInfo.new(dist / velocity, Enum.EasingStyle.Linear)
- if not ActualNPC:FindFirstChild("HumanoidRootPart") then return end
- local g = {}
- g.CFrame = ActualNPC.HumanoidRootPart.CFrame
- local Tween = TweenService:Create(HRP, info, g)
- Tween:Play()
- Tween.Completed:Wait()
- AttackEvent:InvokeServer("L")
- else
- PlayerHum:ChangeState(7)
- break
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement