I assume that you are setting the CFrame for the camera. This will cause the camera to teleport instantly. You can use TweenService instead to move the CFrame smoothly
local run = game:GetService'RunService'
local uis = game:GetService'UserInputService'
local cam = workspace.Camera
local plr = game.Players.LocalPlayer
local mult = 180/math.pi
local current = Vector2.zero
local target = current
local speed = 2 -- Set the speed of the animation
local sensitivity = 1 -- Set the sensitivity of the rotation
cam.CameraType = Enum.CameraType.Scriptable
run.RenderStepped:Connect(function(dt)
target += uis:GetMouseDelta()*sensitivity
current = current:Lerp(target, dt*speed)
cam.CFrame = CFrame.Angles(0,current.X*mult,0)*CFrame.Angles(current.Y*mult,0,0)
end)
Can you try this, put it under StarterCharacterScripts.
local run = game:GetService'RunService'
local uis = game:GetService'UserInputService'
local cam = workspace.Camera
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character
local head = char:WaitForChild'Head'
local current = Vector2.zero
local targetX, targetY = 0, 0
local zoom = 10
local targetZoom = zoom
local asin = math.asin
local clamp = math.clamp
local pi = math.pi
local mult = 180/pi
local minZoom, maxZoom = 0.5, 50 -- Set zoom limits
local speed = 2 -- Set the speed of the animation
local sensitivity = 1 -- Set the sensitivity of the rotation
local function lerp(a,b,t)
return a + (b - a) * t
end
cam.CameraType = Enum.CameraType.Scriptable
run.RenderStepped:Connect(function(dt)
local delta = uis:GetMouseDelta()*sensitivity
targetX += delta.X
targetY = clamp(targetY + delta.Y,-90,90)
current = current:Lerp(Vector2.new(targetX,targetY), dt*speed)
zoom = lerp(zoom,targetZoom, dt*speed)
cam.CFrame = CFrame.Angles(0,current.X*mult,0)*CFrame.Angles(current.Y*mult,0,0)*CFrame.new(0,0,zoom)+head.Position
end)
mouse.WheelForward:Connect(function()
targetZoom = targetZoom - 3 < minZoom and minZoom or targetZoom - 3
end)
mouse.WheelBackward:Connect(function()
targetZoom = targetZoom + 3 > maxZoom and maxZoom or targetZoom + 3
end)
I know there is a much better way to do this. I don’t even think this will work
Ok, um, is the realism script still broken? Can you try this?
local run = game:GetService'RunService'
local uis = game:GetService'UserInputService'
local cam = workspace.Camera
local plr = game.Players.LocalPlayer
local mult = 180/math.pi
local current = Vector2.zero
local target = current
local speed = 2 -- Set the speed of the animation
local sensitivity = 1 -- Set the sensitivity of the rotation
cam.CameraType = Enum.CameraType.Scriptable
run.RenderStepped:Connect(function(dt)
target += uis:GetMouseDelta()*sensitivity/2
current = current:Lerp(target, dt*speed)
cam.CFrame = CFrame.Angles(0,current.X/mult,0)*CFrame.Angles(current.Y/mult,0,0)
end)
This is the first script I gave you but modified to not make the camera go crazy
I’m sorry if I’m replying too much. I just want to see which script works with the realism script.
Can you try this
local run = game:GetService'RunService'
local uis = game:GetService'UserInputService'
local cam = workspace.Camera
local plr = game.Players.LocalPlayer
local mult = 180/math.pi
local current = Vector2.zero
local target = current
local speed = 2 -- Set the speed of the animation
local sensitivity = 1 -- Set the sensitivity of the rotation
cam.CameraType = Enum.CameraType.Custom
run.RenderStepped:Connect(function(dt)
target += uis:GetMouseDelta()*sensitivity/2
current = current:Lerp(target, dt*speed)
cam.CFrame = CFrame.Angles(0,current.X/mult,0)*CFrame.Angles(current.Y/mult,0,0)
end)