Swing part of the move only fires once?

I am creating a fighting game, and for the moves, I use two different remotes, the swinging, and the being hit from the client hitbox one. (To make the swinging animation and sounds play globally.) And on one of my moves, aka “Hard Punch”, it seems the swinging part of it only loads in/works once. This could be a roblox issue, but I’m not too sure. Also yes, I ran a print on the swinging remote to make sure it actually ran and yes, it actually did, but for some reason the actions the remote handles don’t seem to come out more than once.

The Local Script/Input Script:

--//Hard Punch
local usedHardPunchLast = 0
uis.InputBegan:Connect(function(key, busy) 
	if busy then return end
	if key.KeyCode == Enum.KeyCode.R and tick() - usedHardPunchLast > 8.5 and not cs:HasTag(player, "CantAttack") and not char:FindFirstChild('Stun') then	
		usedHardPunchLast = tick()	
		game:GetService('ReplicatedStorage').Remotes.Attacks.Sp.HardPunch.Swing:FireServer(player)
		task.wait(.4)
		local hitbox = reusedFunctions.createHitbox(char, Vector3.new(5,6,5.5), CFrame.new(0,0,-3), .2)
		hitbox.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild('Humanoid') and hit.Parent ~= char then
				hitbox.CanTouch = false
				game:GetService('ReplicatedStorage').Remotes.Attacks.Sp.HardPunch:FireServer(hit)
			end
		end)
	end
end)

The server swing script:

local remote = game:GetService('ReplicatedStorage').Remotes.Attacks.Sp.HardPunch.Swing
local cs = game:GetService('CollectionService')

remote.OnServerEvent:Connect(function(player)
	print('hp swing remote fired')
	if not cs:HasTag(player, "swingHardPunchCooldown") then
		cs:AddTag(player, "swingHardPunchCooldown")
		cs:AddTag(player, "CantAttack")	
		task.delay(9, function()--Subtract based on windup
			cs:RemoveTag(player, "swingstarFingerCooldown")
		end)
	
	local animation = player.Character.Humanoid:LoadAnimation(script.Animation)
	animation:Play()
	local oraSound = Instance.new("Sound", player.Character.HumanoidRootPart)
	oraSound.SoundId = "rbxassetid://5577919356"
	oraSound.Volume = .5
	oraSound:Play()
	game.Debris:AddItem(oraSound, 5)

	player.Character.Humanoid.WalkSpeed = 8
	task.wait(.4)
	player.Character.Humanoid.WalkSpeed = player.Character.Values.TrueWalkSpeed.Value
	cs:RemoveTag(player, "CantAttack")	
	end
end)

This could actually be an issue with my anti-exploit server cooldowns being longer than the client cooldown so let me check that real quick.

Nevermind, I found it. It was a typo I didn’t notice.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.