local ball = script.Parent
while task.wait() do
if ball.AssemblyLinearVelocity.Magnitude > 1 then
ball.AssemblyLinearVelocity = Vector3.new(ball.AssemblyLinearVelocity.X * .89, ball.AssemblyLinearVelocity.Y, ball.AssemblyLinearVelocity.Z * .89)
end
end
I made a custom script to deaccelerate a soccer ball. When I apply any kind of upwards velocity the ball floats in the air for a while?? I’m unsure how to solve this but I think it might be something to do with the AssemblyLinearVelocity.Y ?
local ball = script.Parent
while task.wait() do
if ball.AssemblyLinearVelocity.Magnitude > 1 then
ball.AssemblyLinearVelocity = Vector3.new(
ball.AssemblyLinearVelocity.X * 0.89,
ball.AssemblyLinearVelocity.Y * 0.89,
ball.AssemblyLinearVelocity.Z * 0.89
)
end
end
local RunService = game:GetService("RunService")
local Debris = game:GetService("Debris")
local SLOW_MULTIPLIER = .05
local part = script.Parent
RunService.Stepped:Connect(function(time: number, deltaTime: number)
local assemblyLinearVelocity = part.AssemblyLinearVelocity
if assemblyLinearVelocity.Magnitude > 10 then
local slowForce = Instance.new("BodyForce")
slowForce.Force = Vector3.new(-assemblyLinearVelocity.X * SLOW_MULTIPLIER, 0, -assemblyLinearVelocity.Z * SLOW_MULTIPLIER)
slowForce.Parent = part
Debris:AddItem(slowForce, .1)
end
end)
You can actually just use a bodyForce to slow down the ball and it doesn’t affect the ball’s gravity at all.