Hello! I am bored and trying to make a npc that follows sound, so I can use it for other projects. I do not currently know any solutions and no properties are related to my problem; can anyone give me a tip?
You can make a part the NPC follows that gives off the sound. You can use the sound properties to make it distanced based btw, so all you then need to do is make the NPC follow the part and the part to move.
I want to player to make the walking sound, then the npc chases the noise, not the player.
Uhhh yeah one issue. The sounds come from their character… you can detect if the sound was completed by doing sound.Finished:Wait(0) though.
To make the NPC follow the noise, you can just make the NPC follow a certain distance away from the player. You can achieve this with stopping the NPC when it reaches a certain magnitude with the character.
You could set a range, i.e an invisible part. Then, you detect if the player’s character is touching the part. If they are and they are walking, then you can make the dummy follow them.
You can find if the player is walking by testing if the Humanoid.MoveDirection.Magnitude > 0.
Hope this helps
Alternatively you can use Magnitude to find the distance between two parts and check if those two parts are within range or not.
local Range = 20 --in Studs
local Distance = (PartA.Position - PartB.Position).Magnitude
if Distance <= Range then
--NPC starts following you
else
--NPC returns to its original spot
end
I would suggest checking the magnitude of the player distance relative to the monster npc every .Stepped and if its in audible range (a range you determine), check if footstep sounds are at a certain volume and is playing, then waypoint towards the position