Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with Rocket Propulsion, why does it take long for rockerPropulsion to be deleted?

Asked by 4 years ago

I have this code snippet

local bodyForce = Instance.new("RocketPropulsion",a.Parent.Head)
local target = Instance.new("Part")
target.CFrame = launch.CFrame*CFrame.new(0,500,0)
target.Anchored = true
target.CanCollide = false
target.Size = Vector3.new(6,6,6)
target.Parent = game.Workspace
target.Transparency = 1
bodyForce.Target = target
bodyForce.TargetRadius = 10
bodyForce.ThrustP = 5000
bodyForce.MaxThrust = 5000
bodyForce.MaxSpeed = 100
spawn(function()
    local now = tick()
    wait()
    bodyForce:Destroy()     
    print("completed: "..tick()-now)                                            
end)
bodyForce:Fire()
a.Parent.Humanoid.Jump = true

Problem here is that for some reason it prints out "completed: 7.123" which is longer than the interval I wanted when I added the "wait()" function.

Why does it take long for the instance "bodyforce" to be destroyed?

Answer this question