Effects such as Beam, Fire, ParticleEmitter, Smoke, Sparkles, and Trails 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
What is the point of having an item 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 isn’t easy to account for all situations. 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