I have an npc that is a lot smaller than a player, and I want the npc to latch onto a random bodypart of a player when it touches the player. However, I don’t know how to do so. I know I probably have to use welds, but I don’t want the npc to just be positioned in the middle of the random bodypart. I want it to be latched on to the surface of the bodypart. How would I go about doing this?
Not sure exactly, but I think you need a BallSocketConstraint. You can check out the guide on it
Sorry if I wasn’t being specific, but I want the NPC to act as if they were grabbing onto the player’s bodypart and keeping that position relative to the bodypart, something like a weld, but I dont know how to position the NPC and use the weld such that the NPC is grabbing onto the surface of the bodypart, not immersing itself into the center of the bodypart completely.
try this
make baseLimb to arm and weld offset to 0,0,0
I don’t really understand what is happening in the script can you explain briefly what the script does?
bodyPart:GetClosestPointOnSurface(npc.HumanoidRootPart.Position)
Position the npc to the returned Vector3 then just weld it using a WeldConstraint
That works, but for some reason once the npc has latched onto the player the player starts glitching out, becoming unable to walk properly. The player’s walking and jumping animation starts breaking, and afterjumping the player leans forward and becomes immobile for a while. The problems seems to lie within the collision of the NPC, but when I tried to disable the collsiion of the npc the problem continued.
It could because that the npc has mass so the movement is tempered, or because the network owner problem
You can try setting the network owner to the player, see if that helps
I tried setting all parts to massless and setting the network owner to the player, none of them helped
I also found out that once the npc latched onto the player, if the npc’s torso was deleted, for some reason both the npc and player will die