When used on a model in a ViewportFrame, ReplaceBodyPartR15 will instead just hide the part attempting to be replaced.
In the middle is a ReplaceBodyPartR15 in a ViewportFrame and on the right is in the world (which gives the expected behavior).
replacebodypartr15 bug.rbxl (28.8 KB)
This happens outside of Studio as well.
Using it in a ViewportFrame seems to replace the model just fine, but it doesn’t set the CFrame appropriately. This is the UpperTorso after replacement.
As a temporary fix, this:
dummy.Parent = Workspace
dummy.Humanoid:ReplaceBodyPartR15(...)
dummy.Parent = viewportFrame
…set the CFrame right, but didn’t change the size of the other parts. This fix changes both the size and the CFrame:
dummy.Parent = Workspace
dummy.Humanoid:ReplaceBodyPartR15(...)
RunService.Heartbeat:Wait()
dummy.Parent = viewportFrame