Camera Zoom Zone with Smooth Reset thumbnail
0 views0 copies0 likes

Camera Zoom Zone with Smooth Reset

Universal script

Copy it, then test it in your own Studio place.

UI systems Verified

Script code

26 lines · 1.0 KB
Download
local TweenService = game:GetService("TweenService")local player = game:GetService("Players").LocalPlayerlocal zone = workspace:WaitForChild("ZoomZone")local originallocal camera, tween, insideBeforewhile zone.Parent do	local current = workspace.CurrentCamera	if current ~= camera then		if tween then tween:Cancel() end		camera, insideBefore = current, nil		original = camera and camera.FieldOfView	end	local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")	local point = root and zone.CFrame:PointToObjectSpace(root.Position)-- …open Get script for the full source

About this script

Create an anchored, invisible ZoomZone part. This LocalScript checks whether your player is inside the zone and tweens the current camera field of view to 52, then restores its starting value on exit. The zone can be rotated in Studio. Preview it near doors and ramps to avoid abrupt changes in readability, particularly when your character enters from above.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local TweenService = game:GetService("TweenService")
local player = game:GetService("Players").LocalPlayer
local zone = workspace:WaitForChild("ZoomZone")
local original
local camera, tween, insideBefore
while zone.Parent do
	local current = workspace.CurrentCamera
	if current ~= camera then
		if tween then tween:Cancel() end
		camera, insideBefore = current, nil
		original = camera and camera.FieldOfView
	end
	local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
	local point = root and zone.CFrame:PointToObjectSpace(root.Position)
	local half = zone.Size / 2
	local inside = point ~= nil and math.abs(point.X) <= half.X and math.abs(point.Y) <= half.Y and math.abs(point.Z) <= half.Z
	if camera and inside ~= insideBefore then
		if tween then tween:Cancel() end
		tween = TweenService:Create(camera, TweenInfo.new(0.3), {FieldOfView = inside and 52 or original})
		tween:Play()
		insideBefore = inside
	end
	task.wait(0.1)
end
if tween then tween:Cancel() end
if camera then camera.FieldOfView = original end