I am working on a code that clones an npc, puts accesories/clothing from another npc in it and parents it to a ViewportFrame, the clothes work however the accesories don’t.
Code:
Model = Model:Clone()
local Pose = Poses[math.random(#Poses)]:Clone()
for _,accesory in pairs(Model:GetChildren()) do
if accesory:IsA("Accessory") or accesory:IsA("Shirt") or accesory:IsA("Pants") then
accesory.Parent = Pose
end
end
Model.Head:FindFirstChildOfClass("Decal").Parent = Pose.Head
Pose.Parent = Showcase.Showcase.ViewportFrame
make sure the hats are not anchored and if it still occurs, try parenting the hats to workspace and then to the npc, i’ve had to do that with my game alot
Worked the same as the code in the topic (Didn’t work), also just noticed the hats are misplaced as when I opened output the ViewportFrame got wider and found this:
Uhh, still having this problem… I’ve tried out anything I can think of and still no solution, for now I’ll just replace the pose with the npc standing still until I find one .
Fixed, turns out I had to first parent everything to the workspace then do the swapping. I guess this is what @Donimicc said but I didn’t really get the hint.