local function Throw(Origin, Target, Power, Throwtype, Tackled, Player)
local NewPower = Power
Player.Character.ChildRemoved:Connect(FootballModule.OnChildRemoved)
if Football:IsA("MeshPart") then
if Throwtype ~= 4 then
if Player.Character.Hitbox:GetAttribute("Position") == "QB" then
if Player.Character.Hitbox:GetAttribute("Archetype") == "Gunslinger" then
if Player.Character.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
NewPower = NewPower + 10
else
NewPower = NewPower + 5
end
elseif Player.Character.Hitbox:GetAttribute("Archetype") == "Magician" then
if Player.Character.Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then
NewPower = NewPower - 7
end
end
end
if Throwtype == 1 then
if Player.Character.Hitbox:GetAttribute("Position") == "QB" then
if Player.Character.Hitbox:GetAttribute("Archetype") == "Conductor" then
if Player.Character.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
NewPower = NewPower * .85
else
NewPower = NewPower * .79
end
elseif Player.Character.Hitbox:GetAttribute("Archetype") == "Magician" then
if Player.Character.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
NewPower = NewPower * .80
else
NewPower = NewPower * .77
end
end
else
if Player.Character.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
NewPower = NewPower * .75
else
NewPower = NewPower * .70
end
end
end
if Throwtype == 2 then
if Player.Character.Hitbox:GetAttribute("Position") == "QB" then
if Player.Character.Hitbox:GetAttribute("Archetype") == "Gunslinger" then
if Player.Character.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
NewPower = NewPower * .95
else
NewPower = NewPower * .75
end
end
end
elseif Throwtype == 3 then
Football.Kick:Play()
if Kicked then
NewPower = KickPower
end
elseif Throwtype == 5 then
NewPower = Power * .6
end
end
if Tackled then
NewPower = NewPower * .6
end
Ready = false
if Throwtype ~= 4 then
Football.Client.BallGui.PowerFrame.Bar.PowerLabel.Text = tostring(math.min(Power, 100))
else
Football.Client.BallGui.PowerFrame.Bar.PowerLabel.Text = tostring(math.min(LastPower, 100))
end
Football.CanCollide = true
if Throwtype == 3 then
Football:SetAttribute("Kicked", true)
end
spawn(function()
Football.CanTouch = false
wait(.3)
Football.CanTouch = true
end)
Football.Parent = game.Workspace
Football:SetAttribute("Thrown", true)
Player.Character.Hitbox:SetAttribute("Mode", "Running")
Football:SetAttribute("Catchable", true)
Football:SetAttribute("Kickable", false)
Football:SetAttribute("Equipped", false)
Football:SetAttribute("Throwing", false)
Football:SetAttribute("Snapping", false)
Kicked = false
if Player ~= nil and Player:FindFirstChild("Head") ~= nil then
if Throwtype == 1 or Throwtype == 2 then
Origin = (Player.Head.CFrame * CFrame.new(1.5, 0, 0)).p
elseif Throwtype == 5 then
Origin = (Player.Head.CFrame * CFrame.new(0, -2, 0)).p
else
Origin = Player.Head.CFrame
end
end
local Aim = (Target - Origin).unit
local SpawnPos = Origin + (Aim * 5)
local TargetPos = SpawnPos + (Aim * math.max(1, NewPower))
Football.Position = SpawnPos
if Tackled == false then
Football.Velocity = Aim * NewPower
else
Football.Velocity = (Aim * NewPower) + Vector3.new(0, math.random(5,10), 0)
end
Football.CFrame = CFrame.new(SpawnPos, TargetPos) * CFrame.Angles(math.pi/2, 2, 0)
local BodyVelocity = Instance.new("BodyVelocity", Football)
BodyVelocity.MaxForce = Vector3.new(1e3, 1e3, 1e3)
BodyVelocity.P = NewPower * 100
if Tackled == false then
BodyVelocity.Velocity = (TargetPos - Football.CFrame.p).unit * (NewPower - 5)
else
BodyVelocity.Velocity = ((TargetPos - Football.CFrame.p).unit * NewPower) + Vector3.new(0, math.random(0,15), 0)
end
-- GRAVITY --
Football.FlyingSound:Stop()
Football.FlyingSound:Play()
FreeFalling = true
Ready = true
local i = 0
local Gravity0 = Football:GetAttribute("Gravity")
local Gravity1
local AirRessitance = Football:GetAttribute("AirRessitance")
while FreeFalling do
Gravity1 = Gravity0 + (AirRessitance * (1 - math.abs(Football.CFrame.UpVector.Y)))
if Throwtype ~= 1 or Throwtype ~= 2 or Throwtype ~= 3 or Throwtype ~= 4 or Throwtype ~= 5 then
BodyVelocity.Velocity = BodyVelocity.Velocity + Vector3.new(game.Workspace.GlobalWind.X * .000115, Gravity1 * RunService.Heartbeat:Wait(), 0)
else
BodyVelocity.Velocity = BodyVelocity.Velocity + Vector3.new(game.Workspace.GlobalWind.X * .000115, -38 * RunService.Heartbeat:Wait(), 0)
end
local P = Football.CFrame.p
if Tackled == false then
if Throwtype == 1 or Throwtype == 5 then
i = i + 0.18
if Player.Character.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(math.pi/2, math.pi * i, math.pi/2)
else
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(.75 * math.pi/2, math.pi * i, .75 * math.pi/2)
end
elseif Throwtype == 2 then
i = i + 0.16
if Player.Character.Hitbox:GetAttribute("Position") == "QB" then
if Player.Character.Hitbox:GetAttribute("Archetype") == "Gunslinger" then
if Player.Character.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(math.pi/2, math.pi * i, math.pi/2)
else
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(.75 * math.pi/2, math.pi * i, .75 * math.pi/2)
end
end
end
elseif Throwtype == 3 then
i = i + 0.17
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(math.pi * i, .75 * math.pi/2, .75 * math.pi/2)
elseif Throwtype == 4 then
i = i + 0.08
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(.75 * math.pi/2, math.pi * i, .75 * math.pi/2)
end
else
i = i + 0.1
if Throwtype == 1 or Throwtype == 2 or Throwtype == 5 then
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(.75 * math.pi/2, math.pi * i, .75 * math.pi/2)
else
Football.CFrame = CFrame.new(P, P + BodyVelocity.Velocity + Buffer) * CFrame.Angles(math.pi/2, math.pi * i, math.pi/2)
end
end
end
end
end