What are you attempting to achieve?
I am attempting to make a view port display a pet model within a Billboard Gui through code.
What is the issue?
I am not getting any errors in the output and am unsure of what i am doing wrong. The model and camera are going into the view-port and the viewport.CurrentCamera is set to the correct camera.
What solutions have you tried so far?
I have tried Countless things. I have tried re positioning the camera, model, and rewriting the code. I have searched the devforum in an attempt to find similar issues and work off of that but have come to no success.
I will provide a screenshot and some code below:
local ModelItem = Database.PetModels:FindFirstChild(GetPets[n].Name):Clone() local ViewPortHolder = UIClone.ViewportFrame local ViewPort = UIClone.ViewportFrame local ViewPortCam = Instance.new("Camera", workspace) local ViewPortCamPosition = Vector3.new(CoreModule.ViewPortZoomIncrement, CoreModule.ViewPortZoomIncrement, CoreModule.ViewPortZoomIncrement) ModelItem.Parent = ViewPortHolder ModelItem.PrimaryPart.Position = Vector3.new(0,0,0) local ScriptClone = game.ReplicatedStorage.Scripts:FindFirstChild("ItemRotation"):Clone() ScriptClone.Parent = ModelItem ViewPortCam.Parent = ViewPort ViewPort.CurrentCamera = ViewPortCam ViewPortCam.CFrame = CFrame.new(ViewPortCamPosition, ModelItem.Build.Body.Position) UIClone.ImageColor3 = CoreModule:GetRarityColor(Database.Pets:FindFirstChild(GetPets[n].Name).Rarity.Value) GetItems[i].MainBackground.PetFrame.CanvasSize = UDim2.new(0,0,0,GetItems[i].MainBackground.PetFrame.UIGridLayout.AbsoluteContentSize.Y) for i, v in pairs(ModelItem:GetDescendants()) do if v:IsA("Script") then v:Destroy() elseif v:IsA("BasePart") then v.Anchored = true end end
Again i get no errors, and everything is in the correct place within the View Port Frame.
I am not sure if it is an issue with the CFrame, but i have tried multiple different things for that.
If you have any insights on what to do, or know where the problem is feel free to reply to the thread or DM me.