Really now? Try printing the Humanoid
? That’s honestly strange if it resulted as a nil
value
i printed Humanoid and it returned Nil
Oh, w e l l t h e n
It’s probably the RayInstance that it couldn’t detect maybe? Try this:
if raycastResult then
local RayInstance = raycastResult.Instance
print(RayInstance)
if RayInstance then
local Humanoid = RayInstance.Parent:WaitForChild("Humanoid")
print(Humanoid)
Humanoid:TakeDamage(10)
end
else
print("Something happened? But what? (That or a result has not been found)")
end
it printed “Handle” and also “Infinite yield possible on ‘Workspace.KIDamado80.BlackShortPartedHair:WaitForChild(“Humanoid”)’”
This should work, but what about if it hits hair? Not sure if you already went over it but
if RayInstance then
local Humanoid = RayInstance.Parent:WaitForChild("Humanoid")
if Humanoid == nil then
Humanoid = RayInstance.Parent.Parent
end
print(Humanoid)
if Humanoid then
Humanoid:TakeDamage(10)
end
end
ALSO IM GOING TO BREAK MY KEYBOARD WITH INCORRECT DEVFORUM FORMATING OMG
Because it hit the hair try doing
what I said above
LOL
Ok yeah from the warning it’s attempting to find the hair, didn’t keep that in mind (Since I’ve rarely used RayCasting, I gotcha mate)
if RayInstance then
local Humanoid = RayInstance.Parent:WaitForChild("Humanoid")
if Humanoid == nil then
Humanoid = RayInstance.Parent.Parent
end
print(Humanoid)
Humanoid:TakeDamage(10)
end
yeah it printed “Handle” then the Infinite yield
OmG YoU StOlE My CoDe!!1111
Yeah, just make sure to check if the Humanoid is actually there, because it will error if there is still no Humanoid (if you didnt hit a player)
-- rest of code here lol
if Humanoid then
Humanoid:TakeDamage(10)
end
this is how it looks now it still having the same issue
local part = script.Parent
local partmodel = workspace.Workerthrow
while wait(1) do
for i, v in pairs(game.Workspace:GetChildren()) do
local human = v:FindFirstChild("Humanoid")
local torso = v:FindFirstChild("Head")
if human and torso and human.Health > 0 then
if (torso.Position - part.Position).magnitude < 100 then
part.CFrame = CFrame.new(part.Position, torso.Position)
end
end
end
local origin = part.Position
local direction = part.CFrame.LookVector * 100
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {part, partmodel}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(origin, direction, raycastParams)
if raycastResult then
local RayInstance = raycastResult.Instance
print(RayInstance)
if RayInstance then
local Humanoid = RayInstance.Parent:WaitForChild("Humanoid")
if Humanoid == nil then
Humanoid = RayInstance.Parent.Parent
if Humanoid then
Humanoid:TakeDamage(10)
end
end
end
end
end
Print the Humanoid
before & after changing its value? I swear if you need to do 3 parents
How do you do strike through? (I’m a boomer)
Also, I don’t think you need to do 3 parents…
Just add 2 squiggly lines(~~) at the start & end of your sentence
~~Should look something like this~~
Well, it seems to be not working in the code he sent?
yeah it keeps printing “Handle” for some reason? and also the yield, well it only prints handle once then the Infinite yield
Could it be possible that something could be blocking the Ray from moving at all?
I don’t think so.
But try it.
local Humanoid = RayInstance.Parent:WaitForChild("Humanoid")
if Humanoid == nil then
Humanoid = RayInstance.Parent.Parent:WaitForChild("Humanoid")
if Humanoid then
Humanoid = RayInstance.Parent.Parent.Parent:WaitForChild("Humanoid")
if Humanoid then
Humanoid:TakeDamage(10)
end
end
end
LOL I JUST REALIZED WE FORGOT THE TO ADD WAIT FOR CHILD HUMANOID ON 2ND PARENT LOL
This should work
@KIDamado80 try this it should def work
still prints Handle once and then the Infinite yield
then it is hitting the handle (aka your hair) of something
can you
print(RayInstance.Parent)
bam, now it just prints out my hair name lol
Alright, that’s good.
print(RayInstance.Parent.Parent.Name)