Sometimes my soccer ball doesnt move even though it says the force was applied???
Code:
local function onTouched(hitPart: BasePart)
if hitPart.Name ~= "Ball" or not isKicking then
return
end
ToolManager:setNetworkOwner(hitPart)
hitPart:ApplyImpulse(humanoidRootPart.CFrame.LookVector * power + humanoidRootPart.CFrame.UpVector * height)
print("applied")
local ballPosition = hitPart.Position + Vector3.new(0, humanoidRootPart.Position.Y - hitPart.Position.Y, 0)
local dotProduct = humanoidRootPart.CFrame.LookVector:Dot(ballPosition - humanoidRootPart.Position)
local torsoOrientation = math.acos(dotProduct / (ballPosition - humanoidRootPart.Position).Magnitude)
if torsoOrientation > math.rad(18) and (hitPart.Position - leftArm.Position).Magnitude < (hitPart.Position - rightArm.Position).Magnitude then
task.spawn(function()
for curveAmount = 1, power * .3 do
hitPart:ApplyImpulse(-humanoidRootPart.CFrame.RightVector) -- Apply curve movement
task.wait()
end
end)
hitPart:ApplyAngularImpulse(Vector3.new(0, .3 * power, 0)) -- Apply spin to the ball
elseif torsoOrientation > math.rad(45) and (hitPart.Position - rightArm.Position).Magnitude < (hitPart.Position - leftArm.Position).Magnitude then
task.spawn(function()
for curveAmount = 1, power * .3 do
hitPart:ApplyImpulse(humanoidRootPart.CFrame.RightVector) -- Apply curve movement
task.wait()
end
end)
hitPart:ApplyAngularImpulse(Vector3.new(0, .3 * -power, 0)) -- Apply spin to the ball
end
isKicking = false
resetPower()
end
’
https://gyazo.com/ba95cf466ac3298f461a45dd2ab81cf8
Please watch this video, it will show what I mean.