Heyo. So I’m currently making a gun game, and I want to make it where when you are in 3rd person, you are 70 FOV, but in First person, you are like 100 FOV. Sounds pretty simple but I am unsure how. Thank you all that can help! ^^
The head becomes invisible when you go in first-person so you can check for that to tell if someone is in first-person (writing code is easier than explaining so here).
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
local player = Players.LocalPlayer
local character = player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")
local viewInfo = TweenInfo.new(0.25, Enum.EasingStyle.Linear)
local viewThin = TweenService:Create(camera, viewInfo, {FieldOfView = 70})
local viewWide = TweenService:Create(camera, viewInfo, {FieldOfView = 100})
head:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
if head.LocalTransparencyModifier > 0.5 then
viewWide:Play()
else
viewThin:Play()
end
end)
1 Like
thank you so much, ive been looking for this! this will help my game a lot, thanks! ^^