ServerScriptService.CombatServer.Combat_Handler:52: attempt to index nil with 'Character'

Currently, my Character is being print as nil. I have no idea why whilst I use my module so I’m pretty confused.

function Combat_Handler.BlockBar(Player,Character,Humrp,sequence,Action,enemyHumanoid)
	
	
	local Character = Player.Character
	
	local Humanoid = Character.Humanoid
	
	if Character:FindFirstChild("BlockBar") then
		BStam = Instance.new("NumberValue", Character)
		BStam.Name = "BlockStamina"
		BStam.Value = 100
		local Stam = script.BlockStamina:Clone()
		Stam.Parent = Character.Head

		coroutine.create(function()
			while Character.Parent == workspace.LivingThings do
				if BStam.Value >= 100 then 
					BStam.Value = 100
					Stam.Frame.Visible = false
				elseif BStam.Value < 100 and BStam.Value > 0 then
					if Character:FindFirstChild("Blocking") == nil then
						BStam.Value = BStam.Value + 0.5
						Stam.Frame.Visbile = true
						Stam.Frame.Size = UDim2.new(BStam.Value/100,0,1,0)
					elseif BStam.Value <= 0 then
						DicHandler.add(enemyHumanoid, "LongStun")
						enemyHumanoid.WalkSpeed = 0
						enemyHumanoid.JumpPower = 0
						
					end
				end
			end
		end)
	end
	if Action == "Release" then
		ButtonDown = false
		return Player
	end
end

Currently I tried using the Print method to figure it out, but it failed to print out anything and all I said saw ‘nil’, yet I looked through the other modules and it just didn’t make sense to me. Also, I decided to keep the other Character because I forgot, but both ways it doesn’t work and will just say Character along with Player is nil.

is this in a local script or server script? or module

The script is within a module. Right now it’s meant to be a block bar, and the guardbreak part of the module is in the actual combat module script.

How did you call the function?

I think its because you defined character at the top if the script

function Combat_Handler.BlockBar(Player,Character,Humrp,sequence,Action,enemyHumanoid)

That’s probably a value that’s not a model and that means that it does not have the parts under it

It was fired like this

local RS = game:GetService("ReplicatedStorage")

local Block = RS:WaitForChild("Block")

local Combat_Handler = require(game.ServerScriptService.CombatServer.Combat_Handler)

local SSS = game:GetService("ServerScriptService")
local DicHandler = require(SSS:WaitForChild("DictonaryHandler"))

Block.OnServerEvent:Connect(function(Player, sequence)
	
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	local Humrp = Character.HumanoidRootPart

	if not DicHandler.find(Character, "Stunned") or DicHandler.find(Character, "LongStun") then
		if Combat_Handler.BlockBar() then
			print("We are working")
			Combat_Handler.BlockBar()
		end
	end
end)

Even when I removed it multiple times and printed Character as

local Character = Player.Character

Player would be seen as nil once I printed it out. I don’t really know why Player is nil which is the main issue for me.

I know this may be stupid but try finding character by going into workspace instead

local Character = workspace[player.Name]

I don’t get it either, I’ve had instances where player.Character is nil lol so I just searched workspace.

i dont know why your player is nil though

ServerScriptService.CombatServer.Combat_Handler:52: attempt to index nil with ‘Name’

Is the new error. This is very odd. I might just end up making the Block Module a completely different script but I don’t know right now since the Create Hitbox module is linked directly with the damage.

player is nil then, you need to check how you are setting up parameters ill try to spot anything

can you show you fireclient or fireallclient code

Where the client is fired/ the local script? Or the other module?

ah i meant the fireserver, because the code u show only has onserverevent

local RS = game:GetService("ReplicatedStorage")

local Combat = RS:WaitForChild("Combat")

local Combat_Handler = require(script.Combat_Handler)

local SSS = game:GetService("ServerScriptService")
local DicHandler = require(SSS:WaitForChild("DictonaryHandler"))

Combat.OnServerEvent:Connect(function(Player, sequence)
	
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	local Humrp = Character.HumanoidRootPart
	
	if not DicHandler.find(Character, "Stunned") or DicHandler.find(Character, "LongStun") or Combat_Handler.BlockBar() then
		local Action, Length = Combat_Handler.getAnimation(Humanoid, sequence)
		print("Anims Playing")
		Action:Play()

		Action:GetMarkerReachedSignal("Hitbox"):Connect(function()
			Combat_Handler.CreateHB(Player, Character, Humrp, Length, sequence)
		end)

		wait(Length)

		if string.len(sequence) < 4 then
			Combat:FireClient(Player, false)
		else
			Combat:FireClient(Player, true)
		end
	else
		Combat:FireClient(Player, false)
	end
	
	
end)
UIS.InputBegan:Connect(function(Input, IsTyping)
	if not IsTyping and not isblocking then
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
			if Debounce == false then
				Debounce = true 
				curr = os.clock()
				
				
				local PT = curr - prev
				if PT < 1 then
					sequence = sequence.."L"
					if string.len(sequence) > 4 then
						print("Resetting Combo.")
						sequence = "L"
					end
				else
					sequence = "L"
				end
				
				Combat:FireServer(sequence)
				
				
			end
		end
	end
end)

Combat.OnClientEvent:Connect(function(bool)
	prev = curr
	
	if bool then
		wait(cds[2])
		Debounce = false
	else
		Debounce = false
	end
end)

weird and printing player.Name onserverevent of combat is nil? that doesnt make sense

Yeah, along with that I checked around in the modules, and removed the overbearing amount of params, yet it still has the issue when I try to run the Block Module. So, right now I’m just looking for anything else that might of been overlooked.