I am trying to get my viewport frame to display the player’s avatar, however i am having issues with the model created by CreateHumanoidModelFromDescription
.
When i load into the game to test if the player model displays, the accessories are bugged and seem to not be connected to the player model. Also it doesn’t move when i either change the primary part’s CFrame or when the :Move
function is called on the model.
:Move being used
Moving primary part to origin
Moving player model to workspace
Putting player model back in viewport frame
Me deciding to use CreateHumanoidModelFromDescription
was after i tried the following:
- Using a blank rig which was preset to origin point and cloning accessories onto it (Shirt and pants would update but accessories were broken)
- Cloning the player model from workspace and inserting it into the viewport frame (Model’s limbs were at an offset from the primary part)
local playerService = game:GetService('Players')
local viewportFrame = script.Parent.Parent
local camera = Instance.new('Camera')
camera.Parent = viewportFrame
viewportFrame.CurrentCamera = camera
local localplayer = playerService:CreateHumanoidModelFromDescription(playerService:GetHumanoidDescriptionFromUserId(playerService.LocalPlayer.UserId), Enum.HumanoidRigType.R6)
localplayer.PrimaryPart.CFrame = CFrame.new(0,0,0)
localplayer.Parent = viewportFrame
camera.CFrame = script.Parent.CameraCFrame.Value
Summary
Model is either not updating when inside viewport frame or i don’t know what I’m doing.