Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool = script.Parent
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local TweenService = game:GetService("TweenService")
- local mouse = game.Players.LocalPlayer:GetMouse()
- repeat wait() until game.Players.LocalPlayer.Character
- local debounce = false
- local LiftRightArm = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.LiftRightArm)
- local SendProjectile = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.SendProjectile)
- tool.Activated:Connect(function()
- if debounce == false then
- if mouse.Target then
- for i, v in pairs(game.Workspace:GetChildren()) do
- if v.Name == "Rock" then
- if v:FindFirstChild("Weld") then
- v:FindFirstChild("Weld"):Destroy()
- end
- local playerHead = game.Players.LocalPlayer.Character.Head
- local rayResult = Ray.new(playerHead.Position, (v.Position - playerHead.Position).Unit * 20)
- local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(rayResult, {game.Players.LocalPlayer.Character})
- if hit then
- print(hit)
- local hitPart = hit
- local info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)
- local lift_Goal = {Position = hitPart.Position + Vector3.new(0, 2.5, 0)}
- local LiftTween = TweenService:Create(hitPart, info, lift_Goal)
- LiftRightArm:Play()
- LiftTween:Play()
- LiftTween.Completed:Wait()
- SendProjectile:Play()
- local BV = Instance.new("BodyVelocity")
- BV.Parent = hitPart
- BV.MaxForce = Vector3.new(math.huge, math.huge,math.huge)
- BV.Velocity = CFrame.new(hitPart.Position, mouse.Hit.p).LookVector * 300
- BV.P = 5000
- print("Rock sent flying :D")
- end
- else
- print("Couldn't find any rocks nearby.")
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement