Why AssemblyLinearVelocity Doesn't Throw Object And AssemblyLinearVelocity.Magnitude Doesn't Work?

I tried to re-create Sci-Fi MedVac 4300 then it doesn’t work

--Made by thebrickplanetboy
local Tool = script.Parent
local Debris = game:GetService("Debris")
local MedpackEvent = Tool:WaitForChild("MedpackEvent")

local Handle = Tool:WaitForChild("Handle")
local BeepTone = Handle:WaitForChild("BeepTone")

local ButtonPress = Tool:WaitForChild("ButtonPress")
local Toss = Tool:WaitForChild("Toss")

local function OnServerEvent(Player)
	local Character = Player.Character
	local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
	local Humanoid = Character:WaitForChild("Humanoid")
	local ButtonPressTrack = Humanoid:LoadAnimation(ButtonPress)
	local TossTrack = Humanoid:LoadAnimation(Toss)
	if Tool.Enabled then
		Tool.Enabled = false
		ButtonPressTrack:Play()
		wait(1.6)
		BeepTone:Play()
		wait(.6)
		BeepTone:Play()
		wait(.5)
		TossTrack:Play()
		wait(1.2)
		local MedpackClone = Handle:Clone()
		MedpackClone.CanCollide = true
		MedpackClone.Name = "Medpack"
		MedpackClone.Anchored = false
		MedpackClone.AssemblyLinearVelocity = HumanoidRootPart.CFrame.LookVector * 20 + Vector3.new(0, 20, 0)
		local MedpackCloneScript = Tool.MedpackCloneScript:Clone()
		MedpackCloneScript.Parent = MedpackClone
		MedpackCloneScript.Disabled = false
		Debris:AddItem(MedpackClone, 60)
		MedpackClone.Parent = workspace
		Tool:Destroy()
	end
end


MedpackEvent.OnServerEvent:Connect(OnServerEvent)
--Made by thebrickplanetboy
local MedpackClone = script.Parent
local Rate = 1 / 30
local Time = 2
local Radius = 15
local Heal = 100
local Debris = game:GetService("Debris")
local Humanoids = {}

while MedpackClone.AssemblyLinearVelocity.Magnitude > .1 do
	wait(.25)
end

MedpackClone.Anchored = true
MedpackClone.CanCollide = false

local Part = Instance.new("Part", workspace)
Part.Anchored = true
Part.CanCollide = false
Part.Size = Vector3.new(.2, .2, .2)
Part.BrickColor = BrickColor.new("Toothpaste")
Part.Transparency = .5

local NewCFrame = CFrame.new(MedpackClone.Position) * CFrame.Angles(math.pi / 2, 0, 0)
Part.CFrame = NewCFrame

local SpecialMesh = Instance.new("SpecialMesh", Part)
SpecialMesh.MeshId = "http://www.roblox.com/asset/?id=3270017"
SpecialMesh.Scale = Vector3.new(0, 0, 0)

local HealSoundBegin = Instance.new("Sound", Part)
HealSoundBegin.SoundId = "rbxassetid://75338443"
HealSoundBegin.Name = "HealSoundBegin"
HealSoundBegin.Volume = 1

local HealSoundEnded = Instance.new("Sound", Part)
HealSoundEnded.SoundId = "rbxassetid://75336185"
HealSoundEnded.Name = "HealSoundEnded"

Debris:AddItem(Part, 10)
HealSoundBegin:Play()

local Frames = Time / Rate

for Frame = 1, Frames do
	local Percent = Frame / Frames
	SpecialMesh.Scale = Vector3.new(Percent * Radius * 2, Percent * Radius * 2, 2)
	wait(Rate)
end

HealSoundBegin:Stop()
wait(1)

local function Recursive(Character)
	if Character and Character ~= nil and Character.Parent ~= nil then	
		if Character:IsA("Humanoid") then
			table.insert(Humanoids, Character)
		end
		for _,Child in pairs(Character:GetChildren()) do
			Recursive(Child)
		end
	end
end

Recursive(workspace)
HealSoundEnded:Play()

for Frame = 1, Frames do
	local Percent = Frame / Frames
	Part.Transparency = .5 + .5 * Percent
	Part.CFrame = NewCFrame + Vector3.new(0, 10 * Percent, 0)
	for _,Humanoid in pairs(Humanoids) do
		if Humanoid and Humanoid.Parent ~= nil and  Humanoid.Health > 0 then
			local HumanoidRootPart = Humanoid.Parent:WaitForChild("HumanoidRootPart")
			if HumanoidRootPart ~= nil then
				if (HumanoidRootPart.Position - MedpackClone.Position).Magnitude < Radius + 2 then
					Humanoid.Health = Humanoid.Health + Heal * Rate / Time
				end
			end
		end
	end
	wait(Rate)
end

Part:Destroy()
MedpackClone:Destroy()

Heres the result:

I’ve had similar issues, try setting assembly linear velocity after it has been parented to workspace. That did the fix for me.

1 Like

I know but I tried everything also I doesnt work

Oh I think I see try adding a wait before the velocity yield check. At the moment it’s spawned it the velocity is zero due to some physics engine task scheduling stuff. Probably why it’s anchored the moments it’s thrown.

I think I got a solution now:

repeat 
	wait(.25)
until MedpackClone.AssemblyLinearVelocity.Magnitude < .1