Universal Script 📌
395 Views
1.7k Executions

Legends Improved First Person SWAYLESS

Universal Script 📌
theobscured102
theobscured102Published 10
7 months ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

My first person script but the camera sway feature is removed. Recommended for devices THAT'S LAGGY / low-end devices to prevent camera swaying errors.

View Raw
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local StarterGui = game:GetService("StarterGui")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

local OFFSET_FIRST_PERSON = Vector3.new(0, 0, -0.7)
local OFFSET_OTHER = Vector3.new(0, 0, 0)
local FOV_ADD = 10

local function lerp(a, b, t)
	return a + (b - a) * t
end

local defaultFOV = camera.FieldOfView

local function setupCharacter(char)
	local humanoid = char:WaitForChild("Humanoid")
	local head = char:WaitForChild("Head")

	for _, v in ipairs(char:GetChildren()) do
		if v:IsA("BasePart") and v.Name ~= "Head" then
			v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
				v.LocalTransparencyModifier = v.Transparency
			end)
			v.LocalTransparencyModifier = v.Transparency
		end
	end

	RunService:BindToRenderStep("CameraHandler", Enum.RenderPriority.Camera.Value + 1, function(deltaTime)
		if not char.Parent then return end

		local zoom = (camera.CFrame.Position - head.Position).Magnitude
		local firstPerson = zoom <= 1

		local targetOffset = firstPerson and OFFSET_FIRST_PERSON or OFFSET_OTHER
		humanoid.CameraOffset = humanoid.CameraOffset:Lerp(targetOffset, 5 * deltaTime)



Comments

0
Log in to join the conversation. Login
No comments yet. Be the first!