0

Trying to copy the value of the CurrentCamera of a ViewportFrame to change the value of another ViewportFrame's Current Camera.

-- Localscript
item.MouseButton1Click:Connect(function()
    local EquippedItem = item.Parent.Parent.Parent.EquippedItem

    clientToServer:FireServer(item, EquippedItem)
end)

-- Server Script
clientToServer.OnServerEvent:Connect(function(player, item, equippedItem)
    local thumbnailCamera = item.ViewportFrame:FindFirstChildOfClass('Model'):WaitForChild('ThumbnailCamera')
    
    print(equippedItem.CurrentCamera) -- outputs nil
    equippedItem.CurrentCamera = thumbnailCamera
    print(equippedItem.CurrentCamera) -- outputs ThumbnailCamera

It seems to be changing the value, however visually when pressing play on Roblox Studio, the ViewportFrame is not changing. As you can see in this image, when clicking on the first ViewportFrame the second ViewportFrame on the bottom left is supposed to look the same as the one with the blue brick.

1 Answers1

0

You have to put a copy of the part or model inside the bottom left ViewportFrame as well. Otherwise, it won't work because ViewportFrames can't share cameras.

Vector3
  • 418
  • 2
  • 8