CurrentCamera is not a valid member of ImageButton

I’m trying to clone a union into a “ImageButton” and use the “ImageButton” as the wireframe for the union. When I try to set camera position with creating a new camera and adjusting both CFrame and Vector3 then I get this error: “[CurrentCamera is not a valid member of ImageButton]”

The script:

> local wievObject = game:GetService("ReplicatedStorage").Rooms.Room001:Clone()
> 
> wievObject.Parent = shop:FindFirstChild("Grid").WievPortFrame
> 
> local camera = Instance.new("Camera")
> 
> camera.CFrame = CFrame.new(wievObject.Position + (wievObject.CFrame.LookVector*5)+Vector3.new(1,2,1),wievObject.Position)
> 
> camera.Parent = shop:FindFirstChild("Grid").WievPortFrame
> 
> shop:FindFirstChild("Grid").WievPortFrame.CurrentCamera = camera

It basically means there is no object called CurrentCamera as the child of ImageButtun when it fires. Add a WaitForChild(“CurrentCamera”)

Hi. Use a ViewportFrame no a image button.
You can put a ViewportFrame into ImageButton

Still not fixing it.
@florianne10 I did not understand your suggestion D:

CurrentCamera don’t existe for imagebutton. It’s on ViewportFrame Frames | Documentation - Roblox Creator Hub
You can insert a ViewportFrame in your image button.

1 Like

Thank you :smiley:

textlimittextlimit

1 Like