I'm creating a menu for my game, and to make it a little more stylish I'm trying to make the camera that is fixed to a location on the map follow the mouse slightly, this is the script, that I found here and updated for my map:
local Player = game:GetService("Players").LocalPlayer
local Cursor = Player:GetMouse()
local Camera = workspace.CurrentCamera
local part = workspace:WaitForChild("CamPart")
repeat wait() until Player.Character.Parent == workspace
Camera.CameraSubject = Cursor
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = part.CFrame
Cursor.Move:Connect(function()
Camera.CameraSubject = Cursor
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = part.CFrame
Camera.CFrame = CFrame.new(part.Position, Cursor.Hit.p)
end)
However, with this script the camera literally FOLLOWS my mouse, how can I make it go smoothly? I've tried using math.clamp but I couldn't. Someone can help me?
