Hello! I’m creating a particle emission function and I would like to achieve an effect like in the video where particles appear when the checkpoint is touched and then disappear. Any ideas on how to achieve that?
In the video, you can see how the stars rise and then fall; I’m not sure how to achieve that…
script:
local function emitSparkles(position, partToBeAttached)
-- Create a new ParticleEmitter
local emitter = Instance.new("ParticleEmitter")
emitter.Parent = partToBeAttached -- Assign the emitter to the desired Part object in the game
-- Set the emitter's properties
emitter.Texture = "http://www.roblox.com/asset/?id=5860841663"
emitter.Size = NumberSequence.new(2)
emitter.Speed = NumberRange.new(5, 25)
emitter.Lifetime = NumberRange.new(3)
-- Create a ColorSequence with the desired color
local colorSequence = ColorSequence.new(Color3.fromRGB(255, 255, 127))
-- Set the emitter's color to the ColorSequence
emitter.Color = colorSequence
print("Sparkles emitted at position:", position)
-- Wait for 3 seconds before stopping the emission
wait(3)
print("Stopping sparkles emission")
-- Stop emitting particles
emitter.Enabled = false
end