local Key = {
K = Enum.KeyCode.K,
F = Enum.KeyCode.F,
C = Enum.KeyCode.C,
Z = Enum.KeyCode.Z,
T = Enum.KeyCode.T,
Y = Enum.KeyCode.Y,
P = Enum.KeyCode.P,
O = Enum.KeyCode.O,
E = Enum.KeyCode.E,
}
-- \\ Functions // --
Combat.OnServerEvent:Connect(function(Player)
-- removed Count = 0
local Character = Player.Character
local Humanoid = Character.Humanoid
local Humrp = Character.HumanoidRootPart
if _G.CanAttack == false and _G.Blocking == true then
return
end
if Character:FindFirstChild("Stun") then return end
if not Character:FindFirstChild("Stun") then
local ClashCount = math.random(1, 60)
_G.CanAttack.Value = true
_G.ClashChance.Value = ClashCount
print(_G.ClashChance.Value)
print("WERKKKK")
Count += 1
CM.CombatStarted(Player, Character, Humrp, Count)
print(Count)
_G.CanAttack.Value = false
_G.ClashChance.Value = nil
if Count == 4 then
Count = 0
end
end
local KeyList = {}
for key, value in pairs(Key) do
table.insert(KeyList, key)
end
if not Character:FindFirstChild("Stun") then
if Character.Humanoid:FindFirstChild("Clashing").Value == true then
print("It works")
print(Key[KeyList[math.random(#KeyList)]])
Combat:FireClient("Clashing")
CM.Clashing(Player, Character, Humrp, Key)
end
end
end)
Basically, I give my character the value to do Clashing and place it to true only for it never to print that.
That error occurs because the script still ran after the character left the game (not the player). This is a module script so that does happen. Notice how this error never occurs when you are playing but occurs when you stop running the game.
if Character.Humanoid:FindFirstChild("Clashing").Value == true then
You already have a reference to the character’s humanoid via the variable “Humanoid”, there’s no need to index the character for its humanoid instance here.