RunService=game:GetService("\082\117\110\083\101\114\118\105\099\101")FullyOpaqueDistance=32 LocalPlayer=game.Players.LocalPlayer GhostPlayersSetting=game.ReplicatedStorage.ClientConfig.GhostPlayers PlayerCharacters={}function RegisterPlayer(t)t.CharacterAdded:Connect(function(U)PlayerCharacters[t]=U if GhostPlayersSetting.Value==2 then SetTransparency(U,1)end end)t.CharacterRemoving:Connect(function(U)PlayerCharacters[t]=nil end)PlayerCharacters[t]=t.Character if t.Character~=nil and GhostPlayersSetting.Value==2 then SetTransparency(t.Character,1)end end function SetTransparency(t,U)assert(typeof(t)=="\073\110\115\116\097\110\099\101"and t:IsA("\077\111\100\101\108"),"\077\117\115\116 \112\114\111\118\105\100\101 \097 \118\097\108\105\100 \077\111\100\101\108\046")assert(typeof(U)=="\110\117\109\098\101\114","\077\117\115\116 \112\114\111\118\105\100\101 \097 \118\097\108\105\100 \110\117\109\098\101\114 \102\111\114 \116\114\097\110\115\112\097\114\101\110\099\121\046")local D=math.ceil(U*10)/10 if t~=PlayerCharacters[LocalPlayer]then for t,U in ipairs(t:GetDescendants())do if U:IsA("\066\097\115\101\080\097\114\116")then U.LocalTransparencyModifier=D end end end end function Update()if GhostPlayersSetting.Value==1 then local t=PlayerCharacters[LocalPlayer]and PlayerCharacters[LocalPlayer]:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local U=t~=nil and t.Position or Vector3.new(0,0,0)for t,D in pairs(PlayerCharacters)do if t~=LocalPlayer then local t=D:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local j=t~=nil and(t.Position-U).Magnitude or FullyOpaqueDistance local u=1-math.min(j/FullyOpaqueDistance,1)SetTransparency(D,u)end end end end for t,U in ipairs(game.Players:GetPlayers())do RegisterPlayer(U)end game.Players.PlayerAdded:Connect(RegisterPlayer)GhostPlayersSetting.Changed:Connect(function(t)if t==0 then for t,U in pairs(PlayerCharacters)do SetTransparency(U,0)end elseif t==2 then for t,U in pairs(PlayerCharacters)do SetTransparency(U,1)end end end)
-- Depending on the player's preference, this fades away other players.
--
-- ForbiddenJ

RunService = game:GetService("RunService")

FullyOpaqueDistance = 32

LocalPlayer = game.Players.LocalPlayer
GhostPlayersSetting = game.ReplicatedStorage.ClientConfig.GhostPlayers

PlayerCharacters = {} -- List of character models indexed by player objects.

function RegisterPlayer(player)
	player.CharacterAdded:Connect(function(character)
		PlayerCharacters[player] = character
		if GhostPlayersSetting.Value == 2 then
			SetTransparency(character, 1)
		end
	end)
	player.CharacterRemoving:Connect(function(character)
		PlayerCharacters[player] = nil
	end)

	PlayerCharacters[player] = player.Character
	if player.Character ~= nil and GhostPlayersSetting.Value == 2 then
		SetTransparency(player.Character, 1)
	end
end
function SetTransparency(character, transparency)
	assert(typeof(character) == "Instance" and character:IsA("Model"), "Must provide a valid Model.")
	assert(typeof(transparency) == "number", "Must provide a valid number for transparency.")

	local roundedTransparency = math.ceil(transparency * 10) / 10

	if character ~= PlayerCharacters[LocalPlayer] then
		for i, item in ipairs(character:GetDescendants()) do
			if item:IsA("BasePart") then
				item.LocalTransparencyModifier = roundedTransparency
			end
		end
	end
end
function Update()
	if GhostPlayersSetting.Value == 1 then
		local playerTorso = PlayerCharacters[LocalPlayer]
			and PlayerCharacters[LocalPlayer]:FindFirstChild("HumanoidRootPart")
		local playerPosition = playerTorso ~= nil and playerTorso.Position or Vector3.new(0, 0, 0)

		for player, character in pairs(PlayerCharacters) do
			if player ~= LocalPlayer then
				local rootPart = character:FindFirstChild("HumanoidRootPart")
				local magnitude = rootPart ~= nil and (rootPart.Position - playerPosition).Magnitude
					or FullyOpaqueDistance
				local transparency = 1 - math.min(magnitude / FullyOpaqueDistance, 1)
				SetTransparency(character, transparency)
			end
		end
	end
end

for i, player in ipairs(game.Players:GetPlayers()) do
	RegisterPlayer(player)
end
game.Players.PlayerAdded:Connect(RegisterPlayer)

GhostPlayersSetting.Changed:Connect(function(value)
	if value == 0 then
		for player, character in pairs(PlayerCharacters) do
			SetTransparency(character, 0)
		end
	elseif value == 2 then
		for player, character in pairs(PlayerCharacters) do
			SetTransparency(character, 1)
		end
	end
end)
