Problem with third person and first person switching

so i have a script that switches between first person and third person, the problem is when i switch to third person after i was in first person, my character is invisible. heres the script:

local value = game.Players.LocalPlayer.Info.OTS
local OTS_CAMERA_SYSTEM = require(game.ReplicatedStorage:WaitForChild("OTSS"))


value.Changed:Connect(function(plr)
	if value.Value == true then
		OTS_CAMERA_SYSTEM:Enable()
		OTS_CAMERA_SYSTEM:SetCharacterAlignment(true)
	
	elseif value.Value == false then
		OTS_CAMERA_SYSTEM:Disable()
		plr.CameraMode = Enum.CameraMode.LockFirstPerson
	end
end)

module:

Could you see if the problem is related to this?

I think I found a fix, try this script:

--//Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--//Variables
local LocalPlayer = Players.LocalPlayer
local value = LocalPlayer.Info.OTS

--//Requires
local OTS_CAMERA_SYSTEM = require(ReplicatedStorage:WaitForChild("OTSS"))

--//Functions
value.Changed:Connect(function()
	if value.Value then
		LocalPlayer.CameraMode = Enum.CameraMode.Classic
		LocalPlayer.CameraMinZoomDistance = 5
		
		task.wait(0.3)
		OTS_CAMERA_SYSTEM:Enable()
		OTS_CAMERA_SYSTEM:SetCharacterAlignment(true)
	else
		OTS_CAMERA_SYSTEM:Disable()
		LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
	end
end)

hmm, there switching from first person to third person, i tried making the delay shorter but then the player is haf-transparent, it goes classic first then do the OTS system… is there a way to remove the delay?

I don’t believe so, you can try doing a hacky method with LocalTransparency though.

After around 10 mins of trying I found out how to do it without the delay: (I used LocalTransparencyModifier)

--//Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--//Variables
local LocalPlayer = Players.LocalPlayer
local value = LocalPlayer.Info.OTS

--//Requires
local OTS_CAMERA_SYSTEM = require(ReplicatedStorage:WaitForChild("OTSS"))

--//Functions
value.Changed:Connect(function()
	if value.Value then
		LocalPlayer.CameraMode = Enum.CameraMode.Classic
		LocalPlayer.CameraMinZoomDistance = 5
		
		OTS_CAMERA_SYSTEM:Enable()
		OTS_CAMERA_SYSTEM:SetCharacterAlignment(true)

		for i, descendant in ipairs(LocalPlayer.Character:GetDescendants()) do
			if descendant:IsA("BasePart") then
				descendant.LocalTransparencyModifier = 0
			end
		end
	else
		OTS_CAMERA_SYSTEM:Disable()
		LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
	end
end)