How would I make a first person camera system that moves the angle of the camera when the player moves the mouse and the right mouse button is down? (Like Roblox Studio)

Here is a link to see the game so far: Placement System [Uncopylocked] - Roblox

It is going to be a sandbox tycoon, like welcome to bloxburg. I am working on the camera system that will behave a lot like Roblox Studio. I have got everything working except the system where the camera’s view would rotate when the mouse button 2 is held down and the mouse moves.This is my attempt at it so far, and it is horrible.

UIS.InputChanged:connect(function(inputObject)
	if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
		if EditCam then
		if Editing then
			if PlotRegion3 then
				if Button2Down then
					UIS.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
					pcall(function()
						if inputObject.Delta.X < OldMousePos.X then
							Cam.CFrame = Cam.CFrame*CFrame.Angles(0, 0.05, 0)
						else
							Cam.CFrame = Cam.CFrame*CFrame.Angles(0, -0.05, 0)
						end
					end)
					OldMousePos = Vector2.new(inputObject.Delta.x, inputObject.Delta.Y)
				else
					UIS.MouseBehavior = Enum.MouseBehavior.Default
				end
			end
		end
	end
	end
end)

You would notice on there that the camera only moves along the Y-axis. This is just so I can test it easier. Does anyone know a better way to do this?

2 Likes

Nvm, fixed it myself.

1 Like

Sorry to bump, but would you like to tell me how it was done? I’m trying to do the exact same thing, but I have no idea to this.

3 Likes

@C_onfident It’s now uncopylocked.

1 Like