The Enabled property, much like
ParticleEmitter/Enabled, determines whether sparkle particles are emit. Any particles already emit will continue to render until their lifetime expires. This property is useful for keeping pre-made sparkle effects off until they are needed later. Since sparkle particles are destroyed when the
Instance/Parent is set to nil, this property is useful in allowing existing particles the opportunity to expire before destroying the Fire object altogether. See the function below.
local Debris = game:GetService("Debris") local part = script.Parent function stopSparkling(sparkles) sparkles.Enabled = false -- No more new particles Debris:AddItem(sparkles, 4) -- Remove the object after a delay (after existing particles have expired) end stopSparkling(part.Sparkles)
The code sample below gives any new players sparkles that are colored the same as their torso color.
local Players = game.Players local function onCharacterSpawned(character) local hrp = character:WaitForChild("HumanoidRootPart") -- Add sparkles that are colored to the player's torso color local sparkles = Instance.new("Sparkles") sparkles.Parent = hrp sparkles.SparkleColor = character:WaitForChild("Body Colors").TorsoColor.Color sparkles.Enabled = true end local function onPlayerAdded(player) player.CharacterAdded:Connect(onCharacterSpawned) end Players.PlayerAdded:Connect(onPlayerAdded)