For my character customization system, I’m using a viewport frame to render the player’s current model within the GUI. However, with this new loop I added to update this viewport I instead recieve the error of " WorldModel is not a valid member of ViewportFrame". I’ve searched for solutions on the forum but couldn’t find anything that applied to my case directly. Any help figuring this out will be appreciated! ^ - ^
function renderPlayer()
local newCamera = Instance.new("Camera")
newCamera.Parent = PlayerFrame
PlayerFrame.CurrentCamera = newCamera
for _, child in pairs(PlayerFrame:GetChildren()) do
if child:IsA("Camera") or child:IsA("Model") then
child:Remove()
end
end
clonedCharacter.Parent = PlayerFrame.WorldModel
clonedCharacter.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
clonedCharacter.PrimaryPart.CFrame = CFrame.new(Vector3.new(0, 0, 0))
newCamera.CFrame = CFrame.new(Vector3.new(0, 1, -5), Vector3.new(0, 0, 0))
end