Inconsistent Assembly linear velocity

when you land you supposed to be pushed by assembly linear velocity but it does not push
so when the raycast hits and it is supposed to be when the player lands it does assembly linear velocity but it is inconsistent.
the script creates a linear velocity on the server with this line of code

StrikerRemote:FireServer(true, "Ability", StrikeDirection, self.Speed, self.TurnSpeed)

and destroy the linear velocity on the server with this line of code

StrikerRemote:FireServer(false, "Ability")
		StrikerRemote:FireServer(true, "Ability", StrikeDirection, self.Speed, self.TurnSpeed)
		
		local LinearVelocity = self.HRP:WaitForChild("StrikerVelocity")
		self.LinearVelocity = LinearVelocity
		
		--if self.LinearVelocity then
		--	self.LinearVelocity:Destroy()
		--	self.LinearVelocity = nil
		--end
		
		--local LinearVelocity = Instance.new("LinearVelocity")
		--LinearVelocity.Attachment0 = self.HRP.RootAttachment
		--LinearVelocity.VectorVelocity = StrikeDirection * self.Speed
		--LinearVelocity.Parent = self.HRP
		--LinearVelocity.MaxForce = math.huge
		--LinearVelocity.Name = "StrikerVelocity"
		--self.LinearVelocity = LinearVelocity
		
		--local CurrentDirection = LinearVelocity.VectorVelocity.Unit
		
		if self.StrikeAnimation then
			self.StrikeAnimation:Play()
		end
		
		self.TiltConnection = RunService.RenderStepped:Connect(function(DT)
			self.HRP.CFrame = CFrame.new(self.HRP.Position, self.HRP.Position + LinearVelocity.VectorVelocity.Unit)
		end)
		
		if self.HitConnection then self.HitConnection:Disconnect() self.HitConnection = nil end
		self.HitConnection = RunService.RenderStepped:Connect(function(DT)
			if LinearVelocity then
				local Direction = LinearVelocity.VectorVelocity.Unit
				local raycastparams = RaycastParams.new()
				local Maps = workspace:QueryDescendants(".Map")
				if game.PlaceId == 105120445286941 then
					raycastparams.FilterDescendantsInstances = {self.Character}
					raycastparams.FilterType = Enum.RaycastFilterType.Exclude
				elseif game.PlaceId == 133955877535382 or game.PlaceId == 103436843325849 then
					raycastparams.FilterDescendantsInstances = {Maps, workspace.Lobby}
					raycastparams.FilterType = Enum.RaycastFilterType.Include
				end
				local RaycastResult = workspace:Raycast(self.HRP.Position, Direction * 300, raycastparams) -- actual 6
				if RaycastResult then
					if self.Indication then
						self.Indication.Position = RaycastResult.Position
					end
					if RaycastResult.Distance <= 6 then
						local ResetDoubleJump: BindableEvent = Events:WaitForChild("ResetDoubleJump", 3)
						if ResetDoubleJump then
							ResetDoubleJump:Fire()
						end
						if self.HitConnection then
							self.HitConnection:Disconnect()
							self.HitConnection = nil
						end
						print("landed")
						self.Striking = false
						self.StrikeAnimation:Stop()
						--self.HRP.AssemblyLinearVelocity = Vector3.new(0, 100, 0)
						LinearVelocity:Destroy()
						StrikerRemote:FireServer(false, "Ability")
						if self.LinearVelocity then
							self.LinearVelocity:Destroy()
							self.LinearVelocity = nil
						end
						--LinearVelocity:Destroy()
						if self.TiltConnection then
							self.TiltConnection:Disconnect()
							self.TiltConnection = nil
						end
						if self.LandConnection then
							self.LandConnection:Disconnect()
							self.LandConnection = nil
						end
						self.Humanoid.AutoRotate = true
						task.delay(self.Cooldown, function()
							self.CanStrike = true
						end)
						self:RemoveIndication()
						self.HRP.AssemblyLinearVelocity = Vector3.new(Direction.X, 0, Direction.Z) * math.max(0.7, self.Humanoid.MoveDirection.Magnitude) * self.Speed * 2.5 + Vector3.new(0, 50, 0)
						return
					end
				end
			end
		end)

the main line of code Im talking about is this

self.HRP.AssemblyLinearVelocity = Vector3.new(Direction.X, 0, Direction.Z) * math.max(0.7, self.Humanoid.MoveDirection.Magnitude) * self.Speed * 2.5 + Vector3.new(0, 50, 0)

it is very weird because when I made the raycast shorter the problem happened everytime but when I made raycast longer the player did the assembly linear velocity fine almost all the time

what exactly was inconsistent about it?

oh im sorry I forgot to say that lol.
the problem is that it does not push the player

hmm try this

LinearVelocity:Destroy()
task.wait() --add this
self.HRP.AssemblyLinearVelocity =
	Vector3.new(Direction.X,0,Direction.Z)
	* math.max(0.7,self.Humanoid.MoveDirection.Magnitude)
	* self.Speed * 2.5
	+ Vector3.new(0,50,0)

then switch your raycast loop to use

RunService.Heartbeat

and then change your workspace:Raycast(self.HRP.Position, Direction * 300) to just be

workspace:Raycast(self.HRP.Position, Direction * 10)