I’m making function to check if Fast-Cast can pierce a part, the for a gun.
the canRayPeirce function somehow runs twice meaning
castBehavior.CanPierceFunction = canRayPierce
is running twice?
Things I’ve Tried to Solve The Problem
-
Debugging my code to check if its my code thats the problem or Fast-Cast.
-
Adding a debounce value
This is My Code
function canRayPierce(activeCast, result, velocity, bullet)
local canPierce = false
local depthOfWall = getOfPartDepth(bullet.Position+(-velocity.Unit) , velocity.Unit, result.Instance)
print('sending? : '..tostring(depthOfWall))
if depthOfWall and depthOfWall <= configs:GetAttribute('PierceThickness') then
canPierce = true
else
print('failed? : '..tostring(depthOfWall))
end
return canPierce
end
castBehavior.CanPierceFunction = canRayPierce
This is my output :
… | sending? : 2.6673853397369385 - Server
… | sending? : nil - Server
… | failed? : nil - Server
What should i do? and is it a problem with Studio, Fast-Cast or my Code?