Weird Touched Issue

I made it so the spell prints whatever it hits, however it detects the character, but not any other object.

The touched script is:

script.Parent.Touched:Connect(function(hit)
    print(hit.Name)
end)

That is inside the spell part. Any reply would be appreciated, thanks.

Edit: The output didn’t show for some reason

1 Like
script.Parent.Touched:Connect(function(hit)
print(hit.Name.Parent)

end)
try that

How are you cloning the script into the part? If you do it through a local script then the script won’t even run because the server doesn’t recognize that the script is there.

Try using hit.Parent.Name because hit.Name will probably show the body part of the character, not the character itself

script.Parent.Touched:Connect(function(hit)
    print(hit.Parent.Name)
end)

.Touched does not fire for anchored parts

Because the handle of the tool is welded to your hand so that’s why it’s detecting it.

Maybe a check to see if it’s ur character…

script.Parent.Touched:Connect(function(hit)
     if game.Players:GetPlayerFromCharacter(hit.Parent) == nil then
       print(hit.Name)
    end
end)

I went for tea, I’m going to try out all of these, @RealExoctic I believe that to be the issue :slight_smile:

Are you sure that the part can collide and the part is not anchored?