Script isnt doing anything when remote is fired

hey so im trying to make it so my script does something in this function once it recieves a remote event firing, the event fires but nothing seems to happen.

here’s the code, im not really sure what went wrong but there arent any errors

local weaponinfo = {
	physical = true,
	fist = true,
	damage = 4.5,
}
local tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
if player then
local character = player.Character
	
local handlerfolder = character:WaitForChild("handlerfolder")
local remfolder = handlerfolder:WaitForChild("Remotes")
local m1 = remfolder:WaitForChild("M1")



m1.OnServerEvent:Connect(function(plr)
	local player = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
	if player then
		local character = player.Character
	local Humanoid = character.Humanoid
	local setupfolder = character.setupfolder
	local combo = setupfolder.Combo
	local combotimer = setupfolder.ComboTimer
	
	local function checkForStun(festy)
		for _, tag in pairs(festy) do
			if character:FindFirstChild(tag) then
				return true
			end
		end
	end
		

		
	if checkForStun({"Stun", "Action", "Knocked", "Blocking", "Casting"}) then return end
		
	if tick() - combotimer.Value > 2.25 then
		combo.Value = 0
	end
	
		
	if combo.Value >=4 then
		combo.Value = 3
	end
		
	combotimer.Value = tick()
	
	combo.Value += 1
	
	local animation = Humanoid:LoadAnimation(ReplicatedStorage.Animations:FindFirstChild("Hit".. combo.Value))
	animation:Play()
	

	
	task.wait(0.35)
	if combo.Value >=4 then
		weaponinfo.knockback = true
		weaponinfo.ragdoll = true
			end
			
	
	
	
	
	
	
	
	end
	end)
end
1 Like

Type print("a") before the if statement that checks for stuns and a print("b") after it. If “b” is not printed in the output, that means the problem could be that if statement. I am not sure but I think you should type the function like this:

local function checkForStun(festy)
	local toReturn = false

	for _, tag in pairs(festy) do
		if character:FindFirstChild(tag) then
			toReturn = true
		end
	end

	return toReturn
end
2 Likes

oh dw about it i got a solution on a repost of this but thanks anyway

1 Like