Universal Script 📌
865 Views
1.3k Executions

Legends Improved First Person

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 camera script. I kinda stole some camera scripts from the internet and improved it myself so... credits to the original creators of the scripts here! Also this is open source, just in case you want to add this in your own game.. or smth like that.

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 SWAY_LIMIT = 6
local FOV_ADD = 10

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

local turn = 0
local cameraOffset = Vector3.new()
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



Comments

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