Make buttons in a Surface GUI work with a custom camera CFrame

Hey Scripters,

I am helping my friend make a menu screen and the buttons in Surface GUI won’t work with a custom camera CFrame. How can I make buttons in a Surface GUI work with a custom camera CFrame?

  1. What do you want to achieve?
    Make buttons in a Surface GUI work with a custom camera CFrame.

  2. What is the issue?
    Surface GUI buttons will not work with a custom camera CFrame.

  3. What solutions have you tried so far?
    None. I’ve looked for any solutions on the Dev Forum but couldn’t find any.

1 Like

What is the

script? i think Guis work even with a custom camera script

I mean, like the current camera’s position, and yes, it does work, but the surface GUI will not work.

Is this the 3d menu thingy you are trying to make?

Yes, that is what I am trying to make.

Do you want the Camera to go on the menu?

Or did you accidentally make the buttons a “TextLabel” instead of a “TextButton”

1

Put this on the command bar if you have it enabled

local p=Instance.new("Part",workspace)p.CFrame=workspace.Camera.CFrame p.Name = "CameraMenu" p.Anchored=true p.CanCollide=false p.Transparency=1

Then set the name to “MenuCamera” or something

Then try this local script ( not tested )

local Camera = workspace.CurrentCamera

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = workspace.MenuCamera.CFrame

It is a TextButton and it is not that whenever I interact with the button it doesn’t work with the camera script.

Can i see the camera script then

Camera Script:

local CurrentCam = workspace.CurrentCamera
local MenuCam = game.Workspace.CameraPart
local Focus = game.Workspace.Focus

workcam.CameraType = "Scriptable"
workcam:Interpolate(MenuCam.CFrame, Focus.CFrame, 0.015)

change this to Enum.CameraType.Scriptable

I think workcam does not exist there

local CurrentCam = workspace.CurrentCamera
local MenuCam = game.Workspace.CameraPart
local Focus = game.Workspace.Focus

CurrentCam.CameraType = Enum.CameraType.Scriptable
CurrentCam:Interpolate(MenuCam.CFrame, Focus.CFrame, 0.015)

I’m still unable to interact with the buttons.

its because it isnt scripted yet

Example ( Wont work )

local Play = workspace.Part.SurfaceGui.Play

Play.MouseButton1Click:Connect(function()

end)

It is scripted. Here:

local CurrentCam = workspace.CurrentCamera

script.Parent.MouseButton1Click:Connect(function()
	CurrentCamera.CameraType = Enum.CameraType.Custom
end)

The script.RunContext must be set to client or a LocalScript from StarterPlayerScripts

I still cannot interact with the button.

Tick ‘AlwaysOnTop’ on the SurfaceGui :slight_smile:, also a general rule of thumb for the majority of interactable surfaceGuis to put them in the Players PlayerGui folder, rather than the workspace, and set the adornee - tends to work much better and be much easier to organise.

2 Likes

You Can Try To Make Invisible Button Or A Bit Visible On SurfaceGui, So You Can Interact With Button(-s) Or Something, If You Want Else, Idk, Maybe Set Interactive Radius To inf So You Can Press It From Anywhere. That All I Can Say.