I'm trying to create a character-viewer thing where you click on a character, and their model teleports in the camera view. However, what usually happens is this: 1-NPC teleports, and teleports back 2-The NPC is bald 3-The NPC will eventually load it's hats in and it'll be gone.

But how do I stop this from happening? Originally I was planning on just storing the NPCs in lighting- and clone and teleport them and then enable the animation script. However regardless of it's disabled or not, cloning the NPC disables it's animation completely. What can I do? I know this is possible because I've seen it in games, but I just don't know where to go from here.

Here is one of the methods I tried:

for i,v in pairs(NPC:GetChildren()) do
		if v:IsA('Accessory') or v:IsA('Shirt') or v:IsA('Pants') or v.Name == "Body Colors" then
			v:Destroy()
		end
	end --clear anything from the last character
	for i,v in pairs(LI.Characters[char]:GetChildren()) do
		local item = v:Clone()
		item.Parent = NPC
	end
	NPC.HumanoidRootPart.CFrame = TP.CFrame

Another method I tried was:

for i,v in pairs(workspace.Holder:GetChildren()) do --holds the npc so i can delete it after
	v:Destroy()
end
local character = LI.Characters[char]:Clone() -- li = lighting
character.Parent = workspace.Holder
character.HumanoidRootPart.CFrame = TP.CFrame
character.Animate.Disabled = false -- it never animated, even if it wasn't disabled (this method didn't have any errors aside from that)

1 comment

0

Also, the reason I disabled the animation script was because I was worried about performance, since there will eventually be a pretty decent amount of NPCs waiting to be chosen.