I’m implementing Fastcast into my game because of difficulties of creating my own bullet system from the ground up. I got it to work, however, I’m not able to detect when it hits the head of a humanoid compared to its torso/whatever.
caster.RayHit:Connect(function(ray, result)
local hit = result.Instance
if hit:FindFirstAncestor("Zombies") then
local character = hit:FindFirstAncestorOfClass("Model")
local humanoid = character:FindFirstChildOfClass("Humanoid")
print(hit)
if humanoid and hit == "Head" then
print("TEST")
humanoid:TakeDamage(20)
end
if humanoid and hit ~= "Head" then
humanoid:TakeDamage(1)
end
end
end)
When I print(hit)
it displays Head, however, it doesn’t follow the if-statement of printing “TEST” and the humanoid taking 20 damage.