I’m trying to index a value in a table called DAMAGE, I am literally printing it every 0.1 seconds to check if its nil, and its not. Yet when I reference it in my OnHit function it says attempt to index nil?
function Gauntlet:OnHit(humanoid)
if self._hitdebounce then return end
self._hitdebounce = true
print("Hit someone")
print(self.config.DAMAGE)
humanoid:TakeDamage(self.config.DAMAGE)
task.wait(2)
self._hitdebounce = false
end
I am checking the value every frame and it prints the damage just fine
task.spawn(function()
while true do
task.wait(0.1)
print(self.config.DAMAGE)
end
end)
I could be wrong but
If the table is called “DAMAGE” then why are you making them take the table as damage?
idrk what self.config means so maybe its different but
correct me if im wrong but you say humanoid:TakeDamage(number value) but you gave it a table…?
However I already fixed this issue by instead passing the damage as an argument in the function itself, and sending it when I detect a humanoid collision. No idea why that works and this doesn’t but whatever I guess.