Make hiding Effects easier for first person

,

Effects such as Beam, Fire, ParticleEmitter, Smoke, Sparkles and Trail requires a LocalTransparencyModifier Property that works similarly to how BasePart and Decal do because they get in the way of the camera whenever the player transitions into first person.

This is really annoying for players with items that have effects inside the player.character, whether it’s from their Roblox avatar or in-game (Developer Made Effects)

In-Game (Developer Made Effects):

Particle Emitters

As seen in this video BillboardGUI also get in the way

Player Avatar:

Fire from Accessory

image

What is the point of having an item that is worth 459k R$ or 5744 USD (as of writing 1/13/2020) when you can’t even play games properly?


Additionally I have written a script to hide Effects when the player goes into first person however it is very difficult to account for all situations and having LocalTransparencyModifier would be so much easier for developers to manage.

Although I do think Roblox should have a built-in way to hide these effects similar to how BasePart and Decal work.

Therefore adding this would provide better UX for players and QOL for developers, a win for the entire platform.

Code
--
local Janitor = require(script.Janitor)

local connections = Janitor.new()

local Players = game:GetService("Players")
local localplayer = Players.LocalPlayer

local character = localplayer.Character or localplayer.CharacterAdded:Wait()
local head = character:WaitForChild("Head")

local cache = {}

local Effects = {}

Effects.Modifiers = {
	Transparency = function(vfx: Beam | ParticleEmitter | Trail)
		local LocalTransparencyModifier = 1 - head.LocalTransparencyModifier
		local transparencies = {}
		for _, v: NumberSequenceKeypoint in ipairs(cache[vfx].Transparency.Keypoints) do
			local value = 1 - ((1 - v.Value) * LocalTransparencyModifier)
			local keypoint = NumberSequenceKeypoint.new(v.Time, value, v.Envelope)
			table.insert(transparencies, keypoint)
		end
		vfx.Transparency = NumberSequence.new(transparencies)
	end,

	Size = function(vfx: Fire)
		vfx.Size = cache[vfx].Size * (1 - head.LocalTransparencyModifier)
	end,

	Enabled = function(vfx: Sparkles)
		if head.LocalTransparencyModifier >= 0.5 then
			vfx.Enabled = false
		else
			vfx.Enabled = true
		end
	end,

	Opacity = function(vfx: Smoke) end,
}

Effects.Classes = {
	Beam = { Instance = Instance.new("Beam"), Modifier = Effects.Modifiers.Transparency, Property = "Transparency" },
	Fire = { Instance = Instance.new("Fire"), Modifier = Effects.Modifiers.Enabled, Property = "Size" },
	ParticleEmitter = {
		Instance = Instance.new("ParticleEmitter"),
		Modifier = Effects.Modifiers.Transparency,
		Property = "Transparency",
	},
	Smoke = { Instance = Instance.new("Smoke"), Modifier = Effects.Modifiers.Enabled, Property = "Opacity" },
	Sparkles = { Instance = Instance.new("Sparkles"), Modifier = Effects.Modifiers.Enabled, Property = "Enabled" },
	Trail = { Instance = Instance.new("Trail"), Modifier = Effects.Modifiers.Transparency, Property = "Transparency" },
}

function Effects.isEffect(instance: Instance): boolean
	return Effects.Classes[instance.ClassName]
end

function Effects.getProperty(instance: Instance): String
	return Effects.Classes[instance.ClassName].Property
end

function Effects.getModifier(instance: Instance)
	return Effects.Classes[instance.ClassName].Modifier
end

function Effects.add(vfx: ParticleEmitter)
	table.insert(cache, vfx)
	local property = Effects.getProperty(vfx)
	cache[vfx] = { [property] = vfx[property] }
end

function Effects.remove(vfx: ParticleEmitter)
	local index = table.find(cache, vfx)
	if index then
		table.remove(cache, index)
	end
	cache[vfx] = nil
end

function Effects.handleParticleEmitters(character: Model)
	for _, descendant in ipairs(character:GetDescendants()) do
		if Effects.isEffect(descendant) then
			Effects.add(descendant)
		end
	end

	connections:Add(character.DescendantAdded:Connect(function(descendant)
		if Effects.isEffect(descendant) then
			Effects.add(descendant)
		end
	end))

	connections:Add(character.DescendantRemoving:Connect(function(descendant)
		if Effects.isEffect(descendant) then
			Effects.remove(descendant)
		end
	end))

	connections:Add(head:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
		for _, vfx: Beam | Fire | ParticleEmitter | Smoke | Sparkles | Trail in ipairs(cache) do
			local modifier = Effects.getModifier(vfx)
			modifier(vfx)
		end
	end))

	connections:LinkToInstance(character)
end

Effects.handleParticleEmitters(localplayer.Character)

localplayer.CharacterAdded:Connect(Effects.handleParticleEmitters)
--

  • I agree with this feature request
  • I disagree with this feature request

0 voters



7 Likes

Feature requests should focus on problems, not on proposed solutions: How to post a Feature Request

A more searchable / appropriate title and writing direction for your thread is: “Avatar items with special effects should not impede vision/gameplay”.

Another solution to the problem is for Roblox to go through and remove all effects from previously uploaded avatar items. Avatar items shouldn’t have special effects so that developers don’t need to spend time writing a filter for these items if the effects aren’t compatible with the gameplay/aesthetics of the experience.

This isn’t only about Accessories and removing the effects from them will only hurt the platform and fix a small part of the problem.

The problem is about how these effects get in the way of the player and I proposed a simple way to fix it.

As demonstrated in the videos Particle effects from in-game (Developer Made Effects) also gets in the way more often than effects from Accessories.

Problem: Effects get in the way in first person
Solution: Give us a simple way to modify the effects transparency


@buildthomas thank you for bringing this to my attention it seems like my explanation and examples aren’t clear enough and I will gather more examples

I should have focused more on in-game effects because that is where the problem is, not all users have Accessories with effects.

3 Likes

Even so you may want to write the title to be more broadly about the problem – “LocalTransparencyModifier for Effects” is still 1 proposed solution and doesn’t provide a summary of your problem. That way if someone looks up this problem in the future they’ll find this thread and can support it.

1 Like