Raycast Hitbox 4.01 by TeamSwordphin not responsive(weird behavior going on)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    Make the RayCast hitbox more responsivie on the first hit.

  2. What is the issue?

21:07:45.465 :arrow_forward: (x79) - Client - BattleControl:90
21:07:46.779 Players current input is: I - Client - BattleControl:56
21:07:46.781 I - Client - BattleControl:90
21:07:46.781 Hit 1! - Client - CombatEvents:125
21:07:46.797 Players AP is 6 - Server - BattleFrameWork:63
21:07:46.813 Reached anim keyFrame! - Client - CombatEvents:104
21:07:47.613 NoobGroup3 : Humanoid - Client - CombatEvents:843
21:07:47.629 Attacked!, NoobGroup3 - Server - BattleFrameWork:28
21:07:47.813 :arrow_forward: (x78) - Client - BattleControl:90
21:07:49.113 Players current input is: I - Client - BattleControl:56
21:07:49.114 I - Client - BattleControl:90
21:07:49.114 Hit 1! - Client - CombatEvents:125
21:07:49.130 Players AP is 5 - Server - BattleFrameWork:63
21:07:49.146 :arrow_forward: Reached anim keyFrame! (x2) - Client - CombatEvents:104
21:07:49.147 NoobGroup3 : Humanoid - Client - CombatEvents:843
21:07:49.163 Attacked!, NoobGroup3 - Server - BattleFrameWork:28
21:07:50.146 :arrow_forward: (x92) - Client - BattleControl:90

Up above is the output I get, I have a module script which is stored in replicated storage. When a player triggers a part that is touched by a enemy, it triggers the BattleSceneHandler in the script here.

function module.BattleSceneHandler(player, enemy, result, camera, count)
	--Events
	local combatEvent = replicatedStorage["Combat System"].RemoteCombat
	local onValChange = replicatedStorage["Combat System"].onValueChange
	local BattleExecute = replicatedStorage["Combat System"].BattleExecute
	local BattleEvent = replicatedStorage["Combat System"].BattleStart
	local ArrowHandler = replicatedStorage["Combat System"].ArrowHandler
	local Positioner = replicatedStorage["Combat System"].Positioner
	local Utility = replicatedStorage["Combat System"].Utility
	

	--Control variables
	--Initalize our battle camera
	local BattleCam = coroutine.create(function()
		
		--CamEvents["Camera1"](player, camera)
		
	end)
	local TweenGuis = coroutine.create(function() module.HandleGUI(player) end)
	module.InBattle = true

	--onValChange:FireServer(true)
	
	--is a group battle
	if result then
		combatEvent:FireServer(enemy, "Battle", count)
		--We need to teleport player to combat area.
		module.TeleportPlayer(player)
		coroutine.resume(BattleCam)
		module.HandleGUI(player)

	--not a group battle
	else
		
		combatEvent:FireServer(enemy, false, count)
		module.TeleportPlayer(player)
		coroutine.resume(BattleCam)

	end
	
	module.PositionSpots() --Getting the enemySpots that they are standing on so the arrow selection can handle it the selection with player
	
	print(EnemySpots)
	CamEvents["Camera0"](enemy) --Get enemy Cameras
	warn("Finished setting area!")

	--Variables
	local Arrow = game.Workspace:WaitForChild("BattleArena").ArrowSelect

	Enemies = enemy

	module.WeldWeapon(player)
	
	
	New_Hit_Box = PreloadComponents(player)
	print(New_Hit_Box)
	Params = RaycastParams.new()
	New_Hit_Box.RaycastParams = Params
	
	New_Hit_Box.OnHit:Connect(function(hitPart, hitHum)
		local myHum = player.Character.Humanoid
		if not myHum then return end
		if myHum == hitHum then return end
		print(hitPart.Parent, ":", hitHum)

		DamageHandler:FireServer(nil,nil,hitHum)
		New_Hit_Box:HitStop()


	end)	
	

	
	
	
	BattleExecute:FireServer("InBattle")
	BattleEvent:Fire()--Give player control
	BattleExecute.OnClientEvent:Connect(module.HandleEnemyTurn)
	ArrowHandler.Event:Connect(module.HandleArrowSelection)

	Positioner.Event:Connect(module.PositionPlayerToEnemy)
end

and here is the moveSet function I have here that calls in the HitBox from the raycast module

local moveSets = {
	
	
	["I"] = {
		
		Action = function(Humanoid, player)
			New_Hit_Box:HitStart()
			

			
			
			
			
			preloaded_Animations["M1"]:Play()
			
			
			
			
			
			preloaded_Animations["M1"]:GetMarkerReachedSignal("Hit"):Connect(function()
				warn("Reached anim keyFrame!")
				
				
				

				
			end)
			
			
			
			
			
			
 
			
			--HitBox variables
			
			--currentAnimationTrack = animator:LoadAnimation(M1)
			--currentAnimationTrack:Play()
			
			
			print("Hit 1!")
		end, -- First Hit


	},

	["I_I"] = {
		Action = function(Humanoid,newHitBox)
			
			
			
			local animator = Humanoid:WaitForChild("Animator")
			
			currentAnimationTrack = animator:LoadAnimation(M2)
			currentAnimationTrack:Play()
			
			currentAnimationTrack:GetMarkerReachedSignal("Hit"):connect(function()
				warn("Reached anim keyFrame!")

				

			end)
			
			print("2 hit combo!")
			
		end,
	},

	["I_I_I"] = {
		Action = function(Humanoid,newHitBox)
		

		

			local animator = Humanoid:WaitForChild("Animator")
			
			currentAnimationTrack = animator:LoadAnimation(M3)
			currentAnimationTrack:Play()
			
			currentAnimationTrack:GetMarkerReachedSignal("Hit"):connect(function()
				warn("Reached anim keyFrame!")

				

			end)
			

			
			print("3 hit combo!")
			

		end,
	},

	["I_I_I_I"] = {
		Action = function(Humanoid,newHitBox)
			

			local animator = Humanoid:WaitForChild("Animator")
			
			currentAnimationTrack = animator:LoadAnimation(M4)
			currentAnimationTrack:Play()
			
			currentAnimationTrack:GetMarkerReachedSignal("Hit"):connect(function()
				warn("Reached anim keyFrame!")

				

			end)
		
			
			print("4 hit combo!")
			

		end,
	},

	["I_I_I_J"] = {
		Action = function(Humanoid,newHitBox)
			

			local animator = Humanoid:WaitForChild("Animator")
			local SpecAttack = nil
			SpecAttack = animator:LoadAnimation(SpecialAttack1)
			SpecAttack:Play()
			print("Special Attack!")	
		end,

	},

	["J"] = {
		Action = function()
			print("Med heavy attack")
		end,
	},

	["J_J"] = {
		Action = function()
			print("Med Med Heavy Attack")
		end,
	},
	
	
}

When the player presses I first, there is a delay of 834 ms and after the player presses I again, the delay seems to be gone. The reason I don’t want this delay is because it’s painfully
when trying to do damage to the enemy here in this video. It gets more responsive after a few fits. But why? I need help it feels like im going insane and don’t know what to do.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried pre loading the animations and still nothing, i tried creating the hitbox inside the BattleSceneHandler so it can be loaded or something, and it still has that first delay before getting faster. Im starting to think its the raycast module or something? Because in this tutorial video.

and no it cant be the server or ping because when i do the damage on the client it still shows delay for the first hit and gets faster after.