Issue with welding NPCs to player

As the title says, I am having a very specific issue with welding NPCs to players. NPCs that are in the workspace upon creating a server have no issue, and they can weld properly to the player with the code I have. However, NPCs that are spawned in after the server is created causes the NPCs to not be able to be welded properly, causing the player to weld onto the NPC instead.

There are other things such as Pathfinding, Movers, and Animations that I thought was getting in the way of welding, but I tested it with two separate NPCs, with the conditions stated above, and the same result happened. Network Ownership is also properly applied before welding.

Is there any other possible ways to find the problem, or perhaps something I’m overlooking?

3 Likes

If you could provide rbxl file to the issue I could probably fix it quicker but from what you’re describing I’ve seen this issue before because I’ve gone down the rabit hole with welding and I know a decent amount about network ownership. The only thing that would make sense is the network ownership is being applied to the player instead of the NPC and when the weld is instanced, player has ownership over the NPC and can control the NPC versus the NPC being able to control the player

2 Likes

Well this was already a part of the code before I found this problem, I had to make sure the player had Network Ownership of the NPC to ensure it can weld properly.

Removing all the other game mechanics in the game, the core issue is still present:

  • NPCs spawned during a server’s creation have no issue
  • NPCs spawned after a server’s creation have the said welding issue
3 Likes

Ah yes this makes perfect sense to me why this is happening.

This causes the issue because the player having network ownership at the time of welding allows the player to have control over the NPC, and the welding logic in Roblox of character models is based upon who has network ownership.

The reason this happens is because even though you might be giving the player network ownership, the NPC’s being existent before the players is likely giving them network ownership that overrides anything you do to the player, making it appear that it’s working correctly.

The only solution I can think is if you give network ownership to the NPC, it should repeat the same behavior that you are looking for

2 Likes

Still having the same issue; I’ll provide a video here.

1st NPC I threw is the one that is created during server creation.
2nd NPC is the one that is spawned in afterwards.

2 Likes

Print the network ownership for the player so that we can see the ownership during both NPC’s

2 Likes

Following your advice, I set Network Ownership to nil at the time of the weld, so both NPCs are controlled by the server.

3 Likes

I’m asking you to print it for the player but it couldn’t hurt to print it for both NPC’s and the player. There has to be different ownership taking place between the 1st and the 2nd. The video you showed looks exactly like what I thought it is, the reverse network ownership taking place on the 2nd one

2 Likes

Oh whoops, misread that. Same order of NPCs in video.

2 Likes

that’s great especially if someone else here were to try and help, that tells us both the ownerships taking place. Now we need to try one of my many tricks. Increase your character size to something way bigger than the NPC and see if that fixes your problem. Use a script that makes your characters scale like something huge, maybe use a free admin to fly around with noclip and hit the npc’s, it’s a trick that should force you to have control over the weld, since the NPC appears to be taking the control, which kind of aligns with logic I have over this whole thing

1 Like

if my suggestion doesn’t work, I have a second step for you to try, look at the properties of the weld when you hit the 1st npc, then look at it during the second, and see if the weld is identical or if it changes, you might need to force the Part0 and Part1 using script

1 Like

Before I do these suggests, do you know why NPCs take control over the weld like this?

2 Likes

Yeah lol there used to be these exploits where you could kill and void players using tools and all of it revolved around you giving yourself network ownership over other players and the only way you could do that is by getting bigger than your victim, if your victim was bigger than you, you couldn’t kill or void them, and you would look exactly like you do there with the 2nd NPC

1 Like

Don’t be fooled though it’s not really much about your size but more so about your body mass, as long as your body mass adds up to a body mass larger than the enemy , you have ownership, so really you could just scale one body part really big and it adds up quickly, that’s what people would do. They would scale only their head or their legs to be super big so that they could do it

2 Likes

Wow, you were correct about this, Thank you! I scaled my player character up and I was able to weld all NPCs properly. I’m not much on how to control part mass/weights, is there a consistent method to ensure player character mass is greater than NPCs mass without increasing/decreasing part sizes?

2 Likes

As a developer it should be easy. It was a nightmare for exploiters because all of us would have warfares with buying different avatar items to try and find the bundle with the highest body mass so that we could have the most control over our enemies lol

You’re welcome! I’m really glad that my knowledge helps :slight_smile:

You can try just adding an invisible mesh part into players with all of the collisions set to false and set it to be really large. It should work. If that doesn’t work let me know I have another solution

2 Likes

If you’re curious, as exploiters we used to remove the number values in our humanoid, such as body proportion scale, body depth scale, and body width scale, which would directly scale our character’s body parts to increase in size, and then we found ways to make it so that only specific areas like our head or legs would increase in size while the rest would stay somewhat intact and distorted at the same time lol

2 Likes

Yeah! I just wildly increased the density of player character limbs. Thank you so much for the help!

2 Likes

You’re very welcome :blush:

It was a pleasure. I think your game is really cool. I wish you the best of luck with it :slight_smile:

2 Likes

And @Deluxo_YTL couldn’t you just script the NPC Parts Massless during the welding code to keep their physics from affecting your Humanoid?

I know from other posts that adding any mass to a player (tools or welding players or NPCs) that aren’t Massless can cause physics issues.

2 Likes