Hello, I have ran into a very major issue within my game. When attempting to use the utility modules and their methods and when attempting to call them with certain arguments, the methods receive no data, and thus are given nil or self is the argument itself.
Here is an example
Example
--OOP AI
function Enemy:BindDamageTo(part, bindTime)
local hitted = {}
local damageBind = part.Touched:connect(function(hit)
local char = hit.Parent
local player = Players:FindFirstChild(char.Name)
if not player then return end
local ishumAlive = self:UseOutsideModule(HumanoidUtility, "IsHumanoidAlive", char) -- SOURCE OF ERROR
`--LINE ABOVE IS THE SOURCE OF ERROR
if not ishumAlive then return end
if hitted[char] ~= nil then
hitted[char] = char
local damage = self:GenerateDamage()
char.Humanoid:TakeDamage(damage)
wait(bindTime / 5)
hitted[char] = nil
end
end)
wait(bindTime)
damageBind:Disconnect()
hitted = {}
end
--UTILITY Module code
function HumanoidUtility:IsHumanoidAlive(obj)
local hum, humRoot, _, _ = self:GetMajorComponents(obj)
if not hum or not humRoot then return false end
if hum.Health < 1 then return false end
return true
end
The following error occurs
19:48:47.055 - GetMajorComponents is not a valid member of Model
19:48:47.056 - Stack Begin
19:48:47.056 - Script âServerScriptService.ServerUtility.HumanoidUtilityâ, Line 23 - function IsHumanoidAlive
19:48:47.057 - Script âServerScriptService.EnemyObjects.Enemyâ, Line 27 - function UseOutsideModule
19:48:47.057 - Script âServerScriptService.EnemyObjects.Enemyâ, Line 167
19:48:47.058 - Stack End
It seems to refer to self as the given argument for some reason
Is there any solution to my situation?
A major note:
The form of
function HumanoidUtility:IsHumanoidAlive(obj)
is equivalent to
HumanoidUtility.IsHumanoidAlive = function(self, obj)
Moreover, the utility modules do work; I have tested them. It is only in this given scinario
Not only is this the fact, but the arguments, before being used as in an attempt as a arugment, is NOT nil