So i've got a script in a Mob and what that script does is get the humanoid when a part is touched, but the problem is that i'm using a Touched function and it can't get the humanoid
The player has other models with parts in it (armor made out of parts)
The script:
script.Parent.Damage.Touched:Connect(function(Hit) Hum = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid") if Hum ~= nil then print("Hum found") end
All parts of the avatar are parented under the Character. Use this code:
if Hit.Parent:FindFirstChild("Humanoid") then print("Humanoid Found") end
You're attempting to set a variable to 2 options. That doesn't work. And it will still print even if it doesn't find it.
For extra help, please contact me on Discord.
Bark#4260