local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local UIS = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
local MaxXAxis1 = 0
local MaxXAxis2 = 1919
local Head = Character:WaitForChild("Head")
repeat
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
local function UpdateCam(inputType, gps)
if not gps and inputType.UserInputType == Enum.UserInputType.MouseMovement then
if inputType.Position.X >= MaxXAxis1 and inputType.Position.X <= MaxXAxis2 then
print("\tPosition:",inputType.Position)
Camera:Interpolate(Head.CFrame, Mouse.Hit, .1)
end
end
end
UIS.InputChanged:Connect(UpdateCam)
I'm trying to basically have the camera follow the mouse a bit, like seen in Menu GUI's, are you guys aware of anyway I could achieve this? I've tried interpolating the camera but this is glitchy and doesn't happen the way I want it to, any help?

8 comments
Why are you looping at line 12 to change the CameraType? no loop needed
Sometimes it does not set the CameraType so I do this as a failsafe.
Wouldn't the repeat loop also pose a risk for crashing as there's no yield?
no, not really as it only does this until the CameraType gets set to Scriptable, sometimes the script may run before the player spawns in hence the repeat loop until it is set
Maybe create function that tracks the mouse as it moves, using the center of the screen as a reference. Connect the function to renderstep to update every frame
I heard of this magical setting called First Person
First Person isn't doing it the way I want to though.
is the camera anchored to a point or is it free(as if it can move around freely)?