Hello, so i’m currently trying to show some objects on a ViewportFrame but the output keep on saying: attempt to index nil with ‘Position’ here is my script:
local pet = script.Parent.Parent:FindFirstChildOfClass("Model")
local viewportframe = script.Parent
local cam = Instance.new("Camera")
cam.CFrame = CFrame.new(pet.PrimaryPart.Position + (pet.PrimaryPart.CFrame.lookVector * 4) + Vector3.new(1,1,1) ,pet.PrimaryPart.Position)
cam.Parent = viewportframe
viewportframe.CurrentCamera = cam
local pet = script.Parent.Parent:WaitForChild("Pet1")
local camera = Instance.new("Camera")
camera.CFrame = CFrame.new(pet.PrimaryPart.Position + (pet.PrimaryPart.CFrame.lookVector * 4),pet.PrimaryPart.Position)
camera.Parent = script.Parent```
i did but it still saying Attempt to index nil with ‘Position’