#"attempt to call a table value" error from module script despite returning a boolean?
1 messages · Page 1 of 1 (latest)
server code
module script code
tl;dr, its checking if a raycast hit a humanoid
and im getting an error in the output saying "attempt to call a table value"
check is the function in the module scirpt
hit is a little function that just prints "hit"
doesnt even need to be a function tbh
pal...
^^^
oh yeah mb
function hit()
print("hit")
end
script.fire.OnServerEvent:Connect(function(plr:Player,pos:CFrame)
if equipped == true then
if debounce == false then
debounce = true
result = shoot.fire(plr,pos.Position,pos.LookVector,damage,range,nil)
if result ~= nil then
endPos = result.Position
local hitcheck = check(result)
if hitcheck == true then
hit()
end
else
endPos = pos.Position+pos.LookVector*range
end
script.Parent.tommy.fx:FireClient(plr,endPos)
startPos = script.Parent["3psTommy"].tip.CFrame.Position
trace.trace(plr.Name,startPos,endPos,stats.tracerColor,stats.fadeTime)
wait(firerate)
debounce = false
else return end
end
end)
didnt think the extra stuff was relevant
i get the error at line 40
that still doesnt show where you define check
local lib = require(game.ReplicatedStorage.weps:WaitForChild("library"))
local shoot = lib.basicHitscan
local trace = lib.basicTracer
local check = lib.basicHitcheck
lib is just a module script that requires all the other necessary module scripts
(shoot, trace, check)
shoot and trace work perfectly fine
do you have anything else inside of that module script or just the check functionm
just the check function
local function check(raycast: RaycastResult): boolean
-- wtv
end
return check
still getting the error
wait
im dumb
no code to set the boolean
how would i set the boolean?
what do you mean 😭
the code is taking in a raycastresult, and is trying to spit out a boolean based on whether or not sait raycastresult hit a player
how would i tell the code whther or not to spit out true or false
what 😭
man im just as confused as you what im asking is how would i spit out the boolean if its just returning the function itself
HOLLLYYYY HSIT IM STUPID
IT WAS CALLING THE MODULE SCRIPT INSTEAD OF THE FUNCTION IN THE MODULE SCRIPT
🥀
i know
thats why i told you to change it to a function 😭