Any tip to improve my knife throw script?

here is my knife throw any tips to improve it?

wait(0.2)
	local Character = Player.Character or Player.CharacterAdded:Wait()
	local stand = Character:WaitForChild("Stand")
	
	local knife = script.Knife1:Clone()
	knife.Parent = Workspace
	knife.CFrame = Character:WaitForChild("HumanoidRootPart").CFrame 
	knife.Orientation = Character:WaitForChild("HumanoidRootPart").Orientation
	knife.Parent = workspace
	
	Deb:AddItem(knife,5)
	
	local Vel = Instance.new("BodyVelocity",knife)
	Vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	Vel.Velocity = Character:WaitForChild("HumanoidRootPart").CFrame.lookVector * 50 
	

	local ignorelist = {}

	local antiGravity = Instance.new("BodyForce")
	antiGravity.Force = Vector3.new(0, workspace.Gravity * script.Knife1:GetMass(), 0)
	antiGravity.Parent = script.Knife1

	
	
	knife.Touched:Connect(function(hitpart)
		antiGravity:Destroy()
		if not hitpart:IsDescendantOf(Character) then
			if hitpart.Parent:FindFirstChild("Humanoid") then
				local enemy = hitpart.Parent
				local enemys = players:GetPlayerFromCharacter(enemy)
				if (table.find(ignorelist,enemy) == nil) then
					table.insert(ignorelist,enemy)
					enemy.Humanoid:TakeDamage(4)
					enemy.Humanoid:LoadAnimation(hitanim):Play()
					local Blood = script.Blood:Clone()
					Blood.Parent = enemy.UpperTorso
					enemy.Humanoid.WalkSpeed = 5	
					enemys.Backpack.Value.UsingMove.Value = true
					wait(1.25)
					knife:Destroy()
					antiGravity:Destroy()
					Blood:Destroy()
					enemy.Humanoid.WalkSpeed = 16
					enemys.Backpack.Value.UsingMove.Value = false
				end				
			end
		end
	end)
end)
2 Likes

I suggest to not use debris as it uses the legacy delay which is kind of innacurate, instead

task.delay(5,function()
urknife:Destroy()
end)
1 Like