Im just wondering how would I be able to get a NPC to register that it has touched a wall for example and then destroy the npc?
Well you could either use raycasting or you can use a Touched event,
since you said walls Im assuming the NPC will be running towards something so maybe a racyast right in the center of its humanoidrootpart could work for you, correct me if im wrong though
If you want to use Touched
, then maybe something like this:
local wall = --specify the wall in workspace
wall.Touched:Connect(function(NPC)
NPC:Destroy()
end)
If you want to use Raycasting, refer also to Raycasting | Documentation - Roblox Creator Hub for more information, on how you could use it.
You can use Raycasting, or you can used a Touched event to register that the NPC has touched it
Which one would be better? I have a npc that will walk into a wall which then the script would fire and the npc would disappear and then it would reset its start position
Interesting…Thank you so much! I will look into more raycasting! <3
Depends what your end goal is honestly, for that just use a touch event