Camera Position When Click UI

Is there a way when you click a UI it makes it so your in a camera?

1 Like

Not sure what you mean, do you want the player’s camera to be moved when they click on a GuiObject button?

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Button = script.Parent
local Part = workspace:WaitForChild("Part")
local Camera = workspace.CurrentCamera

	Camera.CameraSubject = Part
	Camera.CameraSubject = Humanoid

Here’s a simple script which will make the camera focus on a part in the workspace when the MouseButton1Click event is fired for a GuiObject button.

Let me explain, you have 3 diffrent cameras. When you go into a part a ui shows up and you can switch through 3 different cameras.

I provided a simple script which you should be able to use to achieve the desired result.

how would u set it up

1 Like

You should use Local Scripts when dealing with Guis.


1 Like

thanks for helping me out! are credits needed?

put in a localScript:

local tweenService = game:GetService("TweenService")
local tinfo =

function setCamera(obj)
if obj then
local goal = {CFrame = obj.CFrame;}
local currentCam = workspace.currentCamera

currentCam.CameraType = Enum.CameraType.Scripteable;
currentCam.CameraSubject = obj

local tween = tweenService:Create(currentCam,tinfo,goal)

what does this do. Does it do the same?