Heyo I have an issue with my particles not getting disabled properly whenever a particle is added I using ChildAdded on the client to detect that and then based off of the users settings (if they have particles disabled or not) I run the function in the module script to disable the particles so I’m not quite sure why the particles are not being disabled unless the code isn’t being ran in the correct order?
--Module
function module.Toggle(Player,Bool)
--print("Toggle Particles: "..tostring(Bool))
for _,Plr in pairs(game:GetService("Players"):GetPlayers()) do
if Plr.Name ~= Player.Name then
for _,Particle in pairs(Plr.Character:GetDescendants()) do
if Particle:IsA("ParticleEmitter") then
print(Particle.Name)
Particle.Enabled = Bool
end
end
end
end
end
--Server
local Left,Right = Particles.RunParticles.Left:Clone(),Particles.RunParticles.Right:Clone()
Left.Parent = HRP
Right.Parent = HRP
local JumpParticle = Particles.JumpParticles:Clone()
JumpParticle.Parent = Part
JumpParticle:Emit(10)
game.Debris:AddItem(Part,2)
--Client
for _,Char in pairs(workspace:GetChildren()) do
if Players:GetPlayerFromCharacter(Char) then
Char.HumanoidRootPart.ChildAdded:Connect(function(Child)
print("FIRST")
print(Child.Name.." Was added")
local Settings = SurfaceGui.Settings.Particles.Value.Value
FXM.Toggle(Player,Settings)
end)
end
end