I’ve been a programmer for a long time, but I never had any problems using the Touched () function, but in my current game (My Game), I had an error, I basically have a skill script, which clones and positions a “Rock” in the workspace and whoever touches it will take damage, it works perfectly on players, but my NPCS (dummys) are not working, and I already found the error, to be able to trigger the Touched () at least one part it can’t be anchored, that’s my problem, because my dummy is not for getting around, so I activate the anchor on his “leg” and the rest will be without anchor to be able to play animation, but it seems that for some reason the "NPC “changes the” Anchored “property, because when running the Script the ´Touched () ´ function will not be connected until all the children of an NPC are without anchor, I could disable anchoring in my” Rock "(part of the skill) but that wouldn’t give you the skill, if someone could help me with this problem I would be very grateful. (Maybe this may seem confusing)
This is my NPC:
as you can see, he has a leg, which will be his “base”, this base that would have to be anchored.
Unfortunately, I believe if any of the parts are anchored, the entire assembly (all of the parts attached to the anchored part through motors or constraints) will not trigger touched events.
touched is unreliable, you should know that if you have been scripting for a “long time” ; use magnitude to detect how close they are or use region3; although i would use magnitude.
it is not so difficult to work with it but I will have to create a loop to check, and my skill will make several stones (50 ~ 100) to cause damage creating a loop on all stones will not cause delay? (sorry if I’m being boring)
I think it would not be a good one, even using magnitude, I would have to check the distance of the stone and a “Torso” of many Npc that I have in my game (30 ~ 50)