I am attempting to make an inventory viewport and usually have no trouble with them but for some reason my chicken is not in view at all even though I am setting the cframe of the camera to look at the chickens humanoidrootpart. I also get no errors.
local CharacterModel = workspace.ChickenInventory[leaderstats.PlayerStats.CurrentChicken.Value]:Clone()
CharacterModel.Parent = InventoryUI.Main.Display.ViewportFrame
CharacterModel.HumanoidRootPart.Anchored = true
local ViewportCamera = Instance.new("Camera")
ViewportCamera.CFrame = CFrame.new(CharacterModel.HumanoidRootPart.Position - Vector3.new(5,0,0), CharacterModel.Headpiece.Position)
ViewportCamera.Parent = InventoryUI.Main.Display.ViewportFrame
InventoryUI.Main.Display.ViewportFrame.CurrentCamera = ViewportCamera
local CharacterAnimAnchor = workspace.ChickenInventory[leaderstats.PlayerStats.CurrentChicken.Value]:Clone()
CharacterAnimAnchor.Parent = workspace
CharacterAnimAnchor.HumanoidRootPart.CFrame = CFrame.new(-223.78, 14.57, -228.75)
local IdleAnim = Instance.new("Animation")
IdleAnim.AnimationId = "rbxassetid://5633571340"
local IdleTrack = CharacterAnimAnchor.Humanoid:LoadAnimation(IdleAnim)
IdleTrack.Looped = true
IdleTrack:Play()
local function updateCharacterModel()
for _,v in ipairs(CharacterAnimAnchor:GetChildren()) do
if v:IsA("BasePart") or v:IsA("Part") or v:IsA("MeshPart") then
CharacterModel:FindFirstChild(v.Name, true).CFrame = v.CFrame
end
end
end
RunService:BindToRenderStep("UpdateCharacterModel", 1, updateCharacterModel)