function CombatHandler.Checks(Player, Character, Humrp, Length)
--------------------------------------------------------
local Character = Player.Character
local Hum = Character.Humanoid
local RayCastingCheckerFirst = RaycastParams.new()
RayCastingCheckerFirst.FilterDescendantsInstances = {Character}
RayCastingCheckerFirst.FilterType = Enum.RaycastFilterType.Blacklist
--local RayCastResult = workspace:Raycast(Humrp)
local Folder = Instance.new("Folder")
Folder.Name = Player.Name.."Folder"
Folder.Parent = workspace
Debris:AddItem(Folder, 0.4)
local g_Hitbox = Meshes.Hitbox:Clone()
g_Hitbox.Parent = Folder
g_Hitbox.CFrame = Humrp.CFrame * CFrame.new(0,0,-3)
local Weld = Instance.new("ManualWeld")
Weld.Part0 = g_Hitbox
Weld.Part1 = Humrp
Weld.C0 = Weld.Part0.CFrame:ToObjectSpace(Weld.Part1.CFrame)
Weld.Parent = Weld.Part0
local pos1 = g_Hitbox.Position - (g_Hitbox.Size/2)
local pos2 = g_Hitbox.Position + (g_Hitbox.Size/2)
local Re3 = Region3.new(pos1, pos2)
local Blacklist = OverlapParams.new()
Blacklist.FilterType = Enum.RaycastFilterType.Blacklist
Blacklist.FilterDescendantsInstances = {Character}
local HBFinder = workspace:GetPartBoundsInBox(Re3.CFrame, Re3.Size, Blacklist)
Debris:AddItem(g_Hitbox, 0.3)
for i, parts in pairs (HBFinder) do
local humanoid = parts.Parent:FindFirstChild("Humanoid")
if humanoid and humanoid.Health > 0 then --The error is proclaimed to be located here
HumanoidFound = true
return parts, g_Hitbox
end
break
end
end
function CombatHandler.MagnitudeCheck(Player, Humrp, parts, g_Hitbox, Length)
Curr = os.clock()
local CurrentPosition = Humrp.CFrame
local HitboxPos = g_Hitbox.CFrame
if (Humrp - parts.Parent.HumanoidRootPart).Magnitude > 6 then --Check if the Player is a realistic amount of studs away from the enemyhumanoid
Humrp.CFrame = CurrentPosition
return
else
if (Humrp - g_Hitbox).Magnitude > 3 then
g_Hitbox.CFrame = Humrp.CFrame * CFrame.new(0,0,-3)
return
else
if table.find(MemoryTable, Player.UserId) then
warn(Player.Name.." already used this remote!")
else
-- allow combat damage on the server
-- remember to add their UserId to the MemoryTable!
local NewBlacklist = table.insert(MemoryTable, Player.UserId)
-- wait a specific amount of time
task.wait(Length)
-- rightfully remove their blacklist
table.remove(MemoryTable, NewBlacklist)
end
end
end
end
Basically, to sum up the gist of my issue, I learned you will not be able to keep a module function within a module function, so what would be the solution to such an issue, ( and please don’t outright say make _G, or make the variables outside of the module script, some of them don’t allow me to do so).
If I ran it purely like this, it gives an error since the value such as Hitbox is nil
Parts would be nil etc…