Advertisement
ThisAccountWhitelist

Untitled

Jul 15th, 2020
1,358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 KB | None | 0 0
  1. local tool = script.Parent
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3. local TweenService = game:GetService("TweenService")
  4. local mouse = game.Players.LocalPlayer:GetMouse()
  5.  
  6. repeat wait() until game.Players.LocalPlayer.Character
  7.  
  8. local debounce = false
  9.  
  10. local LiftRightArm = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.LiftRightArm)
  11. local SendProjectile = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.SendProjectile)
  12.  
  13. tool.Activated:Connect(function()
  14.     if debounce == false then
  15.         if mouse.Target then
  16.             for i, v in pairs(game.Workspace:GetChildren()) do
  17.                 if v.Name == "Rock" then
  18.                     if v:FindFirstChild("Weld") then
  19.                         v:FindFirstChild("Weld"):Destroy()
  20.                     end
  21.                     local playerHead = game.Players.LocalPlayer.Character.Head
  22.                     local rayResult = Ray.new(playerHead.Position, (v.Position - playerHead.Position).Unit * 20)
  23.                     local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(rayResult, {game.Players.LocalPlayer.Character})
  24.                     if hit then
  25.                         print(hit)
  26.                         local hitPart = hit
  27.                         local info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)
  28.                         local lift_Goal = {Position = hitPart.Position + Vector3.new(0, 2.5, 0)}
  29.                         local LiftTween = TweenService:Create(hitPart, info, lift_Goal)
  30.                         LiftRightArm:Play()
  31.                         LiftTween:Play()
  32.                         LiftTween.Completed:Wait()
  33.                         SendProjectile:Play()
  34.                         local BV = Instance.new("BodyVelocity")
  35.                         BV.Parent = hitPart
  36.                         BV.MaxForce = Vector3.new(math.huge, math.huge,math.huge)
  37.                         BV.Velocity = CFrame.new(hitPart.Position, mouse.Hit.p).LookVector * 300
  38.                         BV.P = 5000
  39.                         print("Rock sent flying :D")
  40.                     end
  41.                 else
  42.                     print("Couldn't find any rocks nearby.")
  43.                 end
  44.             end
  45.         end
  46.     end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement