How can I tell if a dummy or npc is touching a player?

I’m doing something that when an npc touches you an animation is played but I don’t know how
realize if the dummy touches a player, anyone can help me?

1 Like

There’s a API for that Players:GetPlayerFromTheCharacter()

1 Like

You can make it so when the Dummy is touched or the Dummy touches something, you can get the Parent of what hit it and use Players:GetPlayerFromCharacter() on that Parent to detect if the dummy has touched a player

The way you can do this can depend on what is needed, you can probably have a hitbox around the dummy (which is just an invisible canCollide false part around the dummy) that does something if whatever touched was a Player’s character, or other methods, but the general idea is to use the method of the Player’s service as it would return the Player instance if what touched was the Player’s Character, or nil if it wasn’t a Player’s character

3 Likes

Dang, you’re good at solving these problems at record speed lol.

3 Likes

That API was helpful to me when i making touch detection for player, there’s so much we can do with simple API

1 Like

Two replies from Scripters real quick.

2 Likes

So cool to see dev’s willing to help each other

2 Likes

Because that’s why DevForum was made.

2 Likes