--//Variables
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
--//Camera Placement
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = CFrame.new(-51.222, 3.74, 57.362)* CFrame.Angles( math.rad(0, 108.52, 0))
print("Camera Switched")
--//Camera Moved
mouse.Move:Connect(function()
local hit = mouse.Hit.Position
local x,y,z = hit.x/100,hit.y/100,hit.z/100
x,y,z = math.clamp(x,-2,2),math.clamp(y,-5,5),math.clamp(z,-2,2) -- you'll have to play with these to get what you want
cam.CFrame = CFrame.new(cam.CFrame.Position, Vector3.new(x,y,z))
end)
You can also divide by a smaller number to increase the sensitivity.
Well, you did most of the work already. The idea behind dividing by 100 is to make it so each change in the mouse position affects the camera less. Previously, each stud that the mouse moved would correspond to a change by 1 stud in the camera, dividing by 100, every 100 studs the mouse moves the camera will move 1.
When you use math.clamp, it returns a value between the minimum and maximum bounds provided, if x>max then x = max and if x<min then x = min.