Welded Parts Shrinking on NPC

Every time I spawn the NPC into the game, the welded parts on it shrink, and I can’t figure out why. I have another NPC that works as intended, so I’m not sure why this one does this. I have tried looking on the Dev Forum, but I can’t find anything that would help.
Here is what the NPC looks like normally:
Screenshot 2024-04-09 112623

Here is what it looks like after spawning in:
image

Any help is appreciated.

4 Likes

If your resizing it using a script, try using ScaleTo()

(I’m not sure if this fixes the problem, since I never actually have needed to resize a character model, but I think it should)

1 Like

I’m not rescaling the parts using a script, they are automatically rescaling themselves after being moved to the spawn location, and I can’t figure out why.

1 Like

Can you show me the script you move them in?

1 Like

There is more inside of this module script, but this is the movement portion (the module script is located in Server Script Service):

local physicsService = game:GetService("PhysicsService")
local serverStorage = game:GetService("ServerStorage")
local mob = {}

function mob.Move(mob, map)
	local humanoid = mob:WaitForChild("Humanoid")
	local waypoints = workspace.Waypoints
		
	for waypoint=1, #waypoints:GetChildren() do
		humanoid:MoveTo(waypoints[waypoint].Position)
		humanoid.MoveToFinished:Wait()
	end
		
	mob:Destroy()
	
end
return mob
2 Likes

I meant the part of the script where they are spawned in, my bad for not clarifying :sweat_smile:

(move as in moved to spawn)

2 Likes
local mob = require(script.Mob)
local map = workspace["Highland Park"]

for wave=1, 5 do
	print("Wave Starting:", wave)
	if wave == 1 then
		mob.Spawn("Armored", 1, map)
	elseif wave == 2 then
		mob.Spawn("Zombie", 4, map)
	elseif wave == 3 then
		mob.Spawn("Zombie", 6, map)
	elseif wave == 4 then
		mob.Spawn("Zombie", 8, map)
	elseif wave == 5 then
		mob.Spawn("Zombie", 10, map)
	end
	
	repeat
		task.wait(1)
	until #workspace.Mobs:GetChildren() == 0
	
	print("Wave Ended")
	task.wait(5)
end
1 Like

what does the mob.Spawn function look like?

1 Like

What do you mean by “look like”?

1 Like

show me the mob.Spawn function code

1 Like

This is the other part of the module script I showed earlier:

function mob.Spawn(name, quantity, map)
	local mobExists = workspace.SpawnMobs:FindFirstChild(name)
	
	if mobExists then
		for i=1, quantity do
			task.wait(1)
			local newMob = mobExists:Clone()
			newMob.HumanoidRootPart.CFrame = workspace.Waypoints[1].CFrame
			newMob.Parent = workspace.Mobs
			newMob.HumanoidRootPart:SetNetworkOwner(nil)
		
			for i, object in ipairs(newMob:GetDescendants()) do
				if object:IsA("BasePart") then
					object.CollisionGroup = "Mob"
				end
			end
		
			coroutine.wrap(mob.Move)(newMob, map)
		end
		
	else
		warn("Requested Mob Does Not Exist", name)
	end
end

use :PivotTo() to move the mob instead of setting the cframe of the HRP

(if this does not work, just send me the whole module script)

3 Likes

Using :PivotTo(), It does teleport the NPC, but the problem with the parts shrinking is persisting.
Here is the full module script (with PivotTo()):

local physicsService = game:GetService("PhysicsService")
local serverStorage = game:GetService("ServerStorage")
local mob = {}

function mob.Move(mob, map)
	local humanoid = mob:WaitForChild("Humanoid")
	local waypoints = workspace.Waypoints
		
	for waypoint=1, #waypoints:GetChildren() do
		humanoid:MoveTo(waypoints[waypoint].Position)
		humanoid.MoveToFinished:Wait()
	end
		
	mob:Destroy()
	
end

function mob.Spawn(name, quantity, map)
	local mobExists = workspace.SpawnMobs:FindFirstChild(name)
	
	if mobExists then
		for i=1, quantity do
			task.wait(1)
			local newMob = mobExists:Clone()
			newMob.HumanoidRootPart:PivotTo(workspace.Waypoints[1].CFrame)
			newMob.Parent = workspace.Mobs
			newMob.HumanoidRootPart:SetNetworkOwner(nil)
		
			for i, object in ipairs(newMob:GetDescendants()) do
				if object:IsA("BasePart") then
					object.CollisionGroup = "Mob"
				end
			end
		
			coroutine.wrap(mob.Move)(newMob, map)
		end
		
	else
		warn("Requested Mob Does Not Exist", name)
	end
end
return mob

i have no idea whats happening here, your not resizing the mob or anything, what happens when using another model?

3 Likes

Most of the other models don’t have extra parts, but one that does have a part connected to the head works just fine (aside from a issue that is unrelated to the welded parts). Is it possible that this is happening because the parts that are welded are a union?

3 Likes

I have never welded to unions before, that could cause some weird things to happen since unions can be a bit weird sometimes, I seriously doubt it though. Can you answer these 3 questions for me?

  1. Do you ever resize the model in another script?
  2. What happens when you move the mob to workspace and press play? Are the parts still resized?
  3. What happens if you don’t move the mob in the script? Do the parts still shrink?
1 Like
  1. Do you ever resize the model in another script?
    The models are not resized in another script.
  2. What happens when you move the mob to workspace and press play? Are the parts still resized?
    It is already in a folder in the workspace, but when I take it out of the folder and have it as a direct child of the workspace, the problem persists.
  3. What happens if you don’t move the mob in the script? Do the parts still shrink?
    Even if the mob isn’t moved, the welded parts still shrink (as far as I can tell, the only parts that are shrinking are the welded parts on the shoulders and arms).
2 Likes

Taking it out of the folder must be the problem here, what happens when you try moving it to another folder?

1 Like

It normally is moved into another folder for active mobs, but even when it isn’t moved from the folder, once I run the game, it shows the parts as shrunk, and when I exit the running game in Roblox Studio, the parts return to their normal size.

1 Like

So, just running the game seems to be the problem. Try making the models unions instead.

1 Like