Advertisement
Treyzotic

Untitled

Jun 10th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.14 KB | None | 0 0
  1. game.ReplicatedStorage.AnimationPlayer.OnServerEvent:Connect(function(Player,...)
  2.  
  3.     local bball = Player.Character:FindFirstChild("Basketball");
  4.    
  5.     bball.BeingShot.Value = true
  6.     local targ = Player.Character.target
  7.     local XG = Player.Character.target.Value.Position.X
  8.     local XZ = Player.Character.target.Value.Position.Z
  9.     local YG = Player.Character.HumanoidRootPart.Position.Y
  10.     local Aim = Vector3.new(XG, YG, XZ)
  11.     local bg = Instance.new('BodyGyro')
  12.     bg.P = 8000
  13.     bg.D = 500
  14.     bg.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  15.     bg.CFrame = CFrame.new(Player.Character.PrimaryPart.Position, Aim)
  16.     bg.Parent = Player.Character.HumanoidRootPart
  17.     print(bg.Parent.." HSDGSFGSDDGSD")
  18.     --bg.Parent = Player.Character.LowerTorso
  19.     --Player.Character.Humanoid.Jump = true
  20.     local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
  21.     for i, v in pairs(AnimationTracks) do
  22.         v:Stop()
  23.     end
  24.     if Player.Character.LowerTorso:FindFirstChild("First") then
  25.         Player.Character.LowerTorso["First"]:Destroy()
  26.         bball.First.Anchored = false
  27.         bg:Destroy()
  28.         local CHCF = Player.Character[Player.Character.Hand.Value.."Hand"].CFrame
  29.         print(CHCF)
  30.        
  31.         bball.First.CFrame = CHCF
  32.     end
  33.     local weld = Instance.new("Weld")
  34.     weld.Part0 = Player.Character[Player.Character.Hand.Value.."Hand"]
  35.     weld.Part1 = bball.First
  36.     weld.Parent = Player.Character["RightHand"]
  37.    
  38.     local run = game:GetService("RunService")
  39.     local HB = run.Heartbeat
  40.     local bball = Player.Character:FindFirstChild("Basketball");
  41.     bball.BeingShot.Value = true
  42.    
  43.     local Hum = Player.Character.Humanoid
  44.     local ID = script.Shooting.Value
  45.     local Anim = Instance.new("Animation")
  46.     Anim.AnimationId = "rbxassetid://"..ID
  47.    
  48.     local humpart = Player.Character:WaitForChild("HumanoidRootPart")
  49.     local Anims = Hum:LoadAnimation(Anim)
  50.     local Distance = (Player.Character.HumanoidRootPart.Position - Player.Character.target.Value.Position).Magnitude
  51.     Anims:Play()
  52.     Anims.Stopped:Connect(function()
  53.         bg:Destroy()
  54.         weld:Destroy()
  55.         local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
  56.         for i, v in pairs(AnimationTracks) do
  57.         v:Stop()
  58.         end
  59.     end)
  60. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement