Is there anything wrong with the script?

game.ReplicatedStorage.FootballEvent.OnClientEvent:Connect(function(origin,target,power,ball)
local FB = ball
ball.Parent.CanBeDropped = false
local config = FB:WaitForChild(‘Configuration’)
local function configure()
local catchable = config:WaitForChild(‘Catchable’)
local canUnequip = config:WaitForChild(‘CanUnequip’).Value
local stayTool = config:WaitForChild(‘ExistAsTool’).Value
gravity = config:WaitForChild(‘Gravity’).Value
if gravity==0 then gravity=0.000000001 end
local friction = config:WaitForChild(‘AirResistance’).Value
end
configure()
local storage = game:GetService(‘ServerStorage’)
local heartbeat = game:GetService(‘RunService’).Heartbeat
local remoteEvent = FB:WaitForChild(‘RemoteEvent’)
local flyingSound = FB:WaitForChild(‘FlyingSound’)
local freeFalling=false
local handoff = false
local ready = true
local passEvent = game.ReplicatedStorage:WaitForChild(‘StatusUpdate’)
local friction = config:WaitForChild(‘AirResistance’).Value
local tool = ball.Parent
if tool:IsA(‘Tool’) then
if tool.Parent.Hitbox.Tackled.Value == false then
ready=false
if ball.WatMan.Value == “Kick” then
game.Workspace.Sounds.Kick:Play()
end
configure()
config:WaitForChild(‘QB’).Value = game.Players:GetPlayerFromCharacter(tool.Parent)
FB.Name = ‘Football’
FB.CanCollide=true
FB.Parent = game.Workspace
tool:Destroy()
handoff=false
config.Equipped.Value = false
local bodyv = Instance.new(‘BodyVelocity’,FB)
if script.Parent:FindFirstChild(“Inaccurate”)== nil then
local aim = (target-origin).unit
local spawnPos = origin + (aim * 12)
local targetPos = spawnPos + (target * power)
FB.Position = spawnPos
FB.Velocity = aimpower1.15
FB.CFrame=CFrame.new(spawnPos,targetPos)CFrame.Angles(math.pi/2,2,0)
bodyv.maxForce = Vector3.new(1e3,1e3,1e3)
bodyv.P=power
115
bodyv.Velocity=(targetPos-FB.CFrame.p).unitpower.95
elseif script.Parent:FindFirstChild(“Inaccurate”)~= nil then
local aim = (target+Vector3.new(0,math.random(3,5),math.random(-1,1))-origin).unit
local spawnPos = origin + (aim 12)
local targetPos = spawnPos + (target * power)
FB.Position = spawnPos
FB.Velocity = aim
power*.89
FB.CFrame=CFrame.new(spawnPos,targetPos)CFrame.Angles(math.pi/1.9,2,0)
bodyv.maxForce = Vector3.new(1e3,1e3,1e3)
bodyv.P=power
115
bodyv.Velocity=(targetPos-FB.CFrame.p).unitpower.75
end
flyingSound:Stop()
flyingSound:Play()
freeFalling=true
ready=true
local i=0
local grav0=gravity
local grav1
game:GetService(“RunService”).RenderStepped:Connect(function()
if freeFalling then
if script.Parent:FindFirstChild(“Inaccurate”)== nil then
if ball.WatMan.Value == “Throw” then
i=i+0.20
grav1 = grav0 + (friction* (1-math.abs(FB.CFrame.upVector.Y)) )
bodyv.Velocity = bodyv.Velocity + Vector3.new(0, grav1 * heartbeat:wait(), 0)
local p = FB.CFrame.p
FB.CFrame=CFrame.new(p,p+bodyv.velocity)CFrame.Angles(math.pi/2,math.pii,math.pi/2)
elseif script.Parent:FindFirstChild(“Inaccurate”)~= nil then
i=i+0.23
grav1 = grav0 + (friction* (1-math.abs(FB.CFrame.upVector.Y)) )
bodyv.Velocity = bodyv.Velocity + Vector3.new(0, grav1 * heartbeat:wait(), 0)
local p = FB.CFrame.p
FB.CFrame=CFrame.new(p,p+bodyv.velocity)CFrame.Angles(math.pi/2.1,math.pii,math.pi/2.1)
end
elseif ball.WatMan.Value == “Kick” then
i=i+0.410
grav1 = grav0 + (friction* (1-math.abs(FB.CFrame.upVector.Y)) )
bodyv.Velocity = bodyv.Velocity + Vector3.new(0, grav1 * heartbeat:wait(), 0)
local p = FB.CFrame.p
FB.CFrame=CFrame.new(p,p+bodyv.velocity)CFrame.Angles(math.pi/2,math.pi/2,math.pii)
end
end
end)
end
end
end)
And it keeps doing this https://gyazo.com/e3308474b264153cf15729cb558eea5d

https://gyazo.com/e3308474b264153cf15729cb558eea5d I don’t know why it keeps doing this, please help.

What’s your issue? How are you trying to achieve this code? Saying that “Is there anything wrong witht he script?” If there seems to be a problem, make sure to use Script Analysis. It helps you tell where the error is located, unknown global variables/symbols, etc. Do keep in mind that the code is much visual in a code block, rather than having it on text without a code block, which seems quite difficult to see what’s wrong.

  1. Describe what the proper behavior of the script should be. We have no idea whats wrong if we don’t know how its supposed to work when its not breaking.

  2. Show output if there are any errors.

  3. I will not even try to read that code. You need to format it so its readable. And only show us the part of the code where you suspect the bug is, I’m not going to read your entire script