Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local Players = game:GetService("Players")
- local CurrentPlayer
- local function PlayerAlive(Player)
- if Player and Player.Character then
- if Player.Character:FindFirstChild("HumanoidRootPart") and Player.Character:FindFirstChild("Humanoid") and Player.Character.Humanoid.Health > 0 then
- if not Players.LocalPlayer or not Players.LocalPlayer.Character or not Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then return nil, nil end
- if (Player.Character.HumanoidRootPart.Position - Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude <= _G.SwordAutofarmRange then
- return Player, Player.Character
- end
- end
- end
- return nil, nil
- end
- local Angle = 1.5
- local R = true
- RunService.Heartbeat:Connect(function()
- if R == true then
- Angle -= 0.75
- if Angle <= 0 then
- R = false
- end
- else
- Angle += 0.75
- if Angle >= 1.5 then
- R = true
- end
- end
- if CurrentPlayer and CurrentPlayer.Character and CurrentPlayer.Character:FindFirstChild("HumanoidRootPart") and CurrentPlayer.Character.Humanoid.Health > 0 then
- if Players.LocalPlayer and Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
- if CurrentPlayer.Character.Humanoid.Jump == true then
- Players.LocalPlayer.Character.Humanoid.Jump = true
- end
- Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.lookAt(Players.LocalPlayer.Character.HumanoidRootPart.Position, Vector3.new(CurrentPlayer.Character.HumanoidRootPart.Position.X + Angle, Players.LocalPlayer.Character.HumanoidRootPart.Position.Y, CurrentPlayer.Character.HumanoidRootPart.Position.Z))
- end
- end
- end)
- RunService.RenderStepped:Connect(function()
- if not (_G.TargetPlayerName == nil) then
- local Player = Players:FindFirstChild(_G.TargetPlayerName)
- if Player then
- if not (Player == Players.LocalPlayer) then
- local Player, Character = PlayerAlive(Player)
- if Player and Character then
- local Tool = Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
- if Tool and Tool:IsA("Tool") and Tool:FindFirstChild("Handle") then
- Tool:Activate()
- CurrentPlayer = Player
- firetouchinterest(Tool.Handle, Character.HumanoidRootPart, 0)
- firetouchinterest(Tool.Handle, Character.HumanoidRootPart, 1)
- end
- end
- end
- end
- elseif (_G.KillWhenTouched == true) then
- if Players.LocalPlayer and Players.LocalPlayer.Character then
- local Tool = Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
- if Tool and Tool:FindFirstChild("Handle") then
- for i, Part in pairs(workspace:GetPartsInPart(Tool.Handle)) do
- local Player, Character = Players:GetPlayerFromCharacter(Part.Parent)
- if Player and Character then
- local Alive = PlayerAlive(Player)
- if Alive then
- Tool:Activate()
- CurrentPlayer = Player
- firetouchinterest(Tool.Handle, Character.HumanoidRootPart, 0)
- firetouchinterest(Tool.Handle, Character.HumanoidRootPart, 1)
- end
- end
- end
- end
- end
- else
- for i, Player in pairs(Players:GetPlayers()) do
- if not (Player == Players.LocalPlayer) then
- local Player, Character = PlayerAlive(Player)
- if Player and Character then
- local Tool = Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
- if Tool and Tool:IsA("Tool") and Tool:FindFirstChild("Handle") then
- Tool:Activate()
- CurrentPlayer = Player
- firetouchinterest(Tool.Handle, Character.HumanoidRootPart, 0)
- firetouchinterest(Tool.Handle, Character.HumanoidRootPart, 1)
- end
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement