🎉

ParticleService

Service for creating ParticleEmitters.
Example usage:
-- Create a record player and add music note particles on all beds
local rainbowColorSequence = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 115, 115)),
ColorSequenceKeypoint.new(0.2, Color3.fromRGB(255, 188, 105)),
ColorSequenceKeypoint.new(0.3, Color3.fromRGB(251, 255, 124)),
ColorSequenceKeypoint.new(0.5, Color3.fromRGB(150, 255, 129)),
ColorSequenceKeypoint.new(0.6, Color3.fromRGB(101, 201, 255)),
ColorSequenceKeypoint.new(0.8, Color3.fromRGB(140, 120, 255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 139, 255)),
})
​
local teams = TeamService.getAllTeams()
for i, team in ipairs(teams) do
local block = TeamService.getTeamBed(team)
local positionAbove = block.position + Vector3.new(0, 2.5, 0)
local recordPlayer = ModelService.createModel(ModelType.RECORD_PLAYER, positionAbove)
​
local emitter = ParticleService.createParticleEmitter(positionAbove, Vector3.new(0, 0, 0))
​
emitter:setTexture("rbxassetid://7065482760")
​
emitter:setRate(1.75)
emitter:setLifetime(NumberRange.new(6, 7))
emitter:setSpeed(NumberRange.new(1.7, 2))
emitter:setDrag(0.25)
emitter:setBrightness(1)
emitter:setParticleOrientation(ParticleOrientation.FacingCamera)
emitter:setSpreadAngle(Vector2.new(-20,45))
emitter:setColor(rainbowColorSequence)
end

Functions

createParticleEmitter(position: Vector3, regionSize: Vector3): ParticleEmitter​

Creates a ParticleEmitter at the specified position. If regionSize is set to Vector3.new(0,0,0), then the particles will emit from a point at the position. Otherwise, the particles will emit from the size of the regionSize.