Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game.ReplicatedStorage.AnimationPlayer.OnServerEvent:Connect(function(Player,...)
- local bball = Player.Character:FindFirstChild("Basketball");
- bball.BeingShot.Value = true
- local targ = Player.Character.target
- local XG = Player.Character.target.Value.Position.X
- local XZ = Player.Character.target.Value.Position.Z
- local YG = Player.Character.HumanoidRootPart.Position.Y
- local Aim = Vector3.new(XG, YG, XZ)
- local bg = Instance.new('BodyGyro')
- bg.P = 8000
- bg.D = 500
- bg.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
- bg.CFrame = CFrame.new(Player.Character.PrimaryPart.Position, Aim)
- bg.Parent = Player.Character.HumanoidRootPart
- print(bg.Parent.." HSDGSFGSDDGSD")
- --bg.Parent = Player.Character.LowerTorso
- --Player.Character.Humanoid.Jump = true
- local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
- for i, v in pairs(AnimationTracks) do
- v:Stop()
- end
- if Player.Character.LowerTorso:FindFirstChild("First") then
- Player.Character.LowerTorso["First"]:Destroy()
- bball.First.Anchored = false
- bg:Destroy()
- local CHCF = Player.Character[Player.Character.Hand.Value.."Hand"].CFrame
- print(CHCF)
- bball.First.CFrame = CHCF
- end
- local weld = Instance.new("Weld")
- weld.Part0 = Player.Character[Player.Character.Hand.Value.."Hand"]
- weld.Part1 = bball.First
- weld.Parent = Player.Character["RightHand"]
- local run = game:GetService("RunService")
- local HB = run.Heartbeat
- local bball = Player.Character:FindFirstChild("Basketball");
- bball.BeingShot.Value = true
- local Hum = Player.Character.Humanoid
- local ID = script.Shooting.Value
- local Anim = Instance.new("Animation")
- Anim.AnimationId = "rbxassetid://"..ID
- local humpart = Player.Character:WaitForChild("HumanoidRootPart")
- local Anims = Hum:LoadAnimation(Anim)
- local Distance = (Player.Character.HumanoidRootPart.Position - Player.Character.target.Value.Position).Magnitude
- Anims:Play()
- Anims.Stopped:Connect(function()
- bg:Destroy()
- weld:Destroy()
- local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
- for i, v in pairs(AnimationTracks) do
- v:Stop()
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement