This is super cool! Always wanted to have 3D particles in my games but I couldn’t find a decent way to make that work.
Pretty sure i’m doing something wrong, but I tried to use the module today and I encountered a couple issues:
Particles never being destroyed.wmv (Sorry for the lag, using an old laptop for a few days and on top of that I used the roblox recorder)
As seen in the vid, for some reason the parts are never being removed upon calling :Destroy()? Not only that but they seem to become visible after they are done playing, and they just kind of stay static in the air
here's the code I used
local function WallSlideParticle(Bool)
if Bool == true then
WallSlideEffectPart = Instance.new("Part"); WallSlideEffectPart.CanCollide = false; WallSlideEffectPart.CanTouch = false --I'd love it if this worked with attachments
WallSlideEffectPart.CanQuery = false; WallSlideEffectPart.Size = Vector3.new(1, 1, 1); WallSlideEffectPart.Transparency = 1
WallSlideEffectPart.CFrame = (RootPart.CFrame + Vector3.new(0, 0, -0.5)); WallSlideEffectPart.Parent = RootPart
local Weld = Instance.new("WeldConstraint"); Weld.Parent = WallSlideEffectPart; Weld.Part0 = RootPart; Weld.Part1 = WallSlideEffectPart
WallSlideEffectCall = Particles3D.new(WallSlideEffectPart, WallSlideEffect.Mesh.MeshId, WallSlideEffect.Mesh.TextureId)
WallSlideEffectCall.EmissionDirection = "Top"; WallSlideEffectCall.Lifetime = NumberRange.new(1, 1.2)
WallSlideEffectCall.Rate = 15; WallSlideEffectCall.Speed = 3; WallSlideEffectCall.SpreadAngle = Vector2.new(0, 10)
WallSlideEffectCall.Transparency = NumberSequence.new{
NumberSequenceKeypoint.new(0, 1),
NumberSequenceKeypoint.new(0.3, 0.4),
NumberSequenceKeypoint.new(1, 1),
}
WallSlideEffectCall.Size = NumberSequence.new{
NumberSequenceKeypoint.new(0, 0.2),
NumberSequenceKeypoint.new(0.3, 0.4),
NumberSequenceKeypoint.new(1, 0)
}
WallSlideEffectCall.Enabled = true
else
if WallSlideEffectCall ~= nil then --If the wallslide effect exists
WallSlideEffectCall.Enabled = false --Stop particle
local StoreEffect = WallSlideEffectCall; WallSlideEffectCall = nil --If we touch another wall, we need the variable free again
local StorePart = WallSlideEffectPart; WallSlideEffectPart = nil --If we touch another wall, we need the variable free again
task.delay(1.5, function() --Give the particle time to dissapear
if StoreEffect then --If it still exists destroy it
StoreEffect:Destroy()
end
task.delay(0.5, function() --I assume it takes a bit to destroy the particles so wait a bit before destroying the part
if StorePart then --If its part still exists too, destroy it
StorePart:Destroy()
end
end)
end)
end
end
end
After that I tried removing the cache system, and it kind of did the trick, parts were getting destroyed now (with a couple rare exceptions that I assume didn’t get destroyed due to lag), but particles now showed for a split second before being destroyed.
Transparency and Direction not working.wmv
Then I tried using the exact same code for this walking particle (only difference being the surface and size, but the transparency didn’t seem to change even after removing the wallslide effect and the direction of the particle didn’t seem to follow the part either, as seen in the vid it always goes to the left.
code again
local function SetupRunParticle()
--Get Floor
local CharPos, CharSize = Character:GetBoundingBox()
local Floor = CharPos.Position - Vector3.new(0, CharSize.Y / 2, 0)
--Effect
RunEffectPart = Instance.new("Part"); RunEffectPart.CanCollide = false; RunEffectPart.CanTouch = false
RunEffectPart.CanQuery = false; RunEffectPart.Size = Vector3.new(1, 1, 1); RunEffectPart.Transparency = 1
RunEffectPart.CFrame = (RootPart.CFrame + Vector3.new(0, Floor.Y - RootPart.Position.Y, -0.2)); RunEffectPart.Parent = RootPart
local Weld = Instance.new("WeldConstraint"); Weld.Parent = RunEffectPart; Weld.Part0 = RootPart; Weld.Part1 = RunEffectPart
RunEffectCall = Particles3D.new(RunEffectPart, WallSlideEffect.Mesh.MeshId, WallSlideEffect.Mesh.TextureId)
RunEffectCall.EmissionDirection = "Back"; RunEffectCall.Lifetime = NumberRange.new(0.5, 0.7);
RunEffectCall.Rate = 6; RunEffectCall.Speed = 3; RunEffectCall.SpreadAngle = Vector2.new(10, 0);
RunEffectCall.Transparency = NumberSequence.new{
NumberSequenceKeypoint.new(0, 1),
NumberSequenceKeypoint.new(0.3, 0.4),
NumberSequenceKeypoint.new(1, 1),
}
RunEffectCall.Size = NumberSequence.new{
NumberSequenceKeypoint.new(0, 0.3),
NumberSequenceKeypoint.new(0.3, 0.8),
NumberSequenceKeypoint.new(1, 0)
}
end
local function RunParticle(Bool)
if not RunEffectCall or not RunEffectPart then
SetupRunParticle()
end
if Bool == true and MovesetValue.Value == true then
RunEffectCall.Enabled = true
else
RunEffectCall.Enabled = false
end
end
By this point I was completly lost as to what to do, so I just added the caching system again and to my surprise the walking particles destroyed fine but the wallslide ones still didn’t and the transparency still wasn’t working on the walk particle so I don’t really know what to do about it, hoping i’m doing something wrong on my end.