How can I add confetti?

Hi developers
I have very basic knowledge in these things so Ill try to explain the best I can.
I created a Confetti effect using particle emitters, and I want that when someone wins in my game, confetti spawn in the lobby and remain there for like 10 seconds (I put confetti in a transparent part called confettigiver above spawn points) but…Idk how to do this. Here’s the main script that handles the win system.

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--//Variables
local vals = ReplicatedStorage.vals
local Sound1 = script.Parent.TimeSound
local Sound2 = script.Parent.Sound2
local s = script.Stat
local blocco = script.Parent.BloccoPartenza

--//Controls
local timeRemaining = 0

--//Tables
local timeValues = {
	[3] = "Ready",
	[2] = "Steady",
	[1] = "Set",
	[0] = "Go!",
}

--//Loops
while true do
	--//Intermission
	timeRemaining = 30

	repeat
		timeRemaining -= 1
		s.Value = "Intermission... ".. timeRemaining
		task.wait(1)
	until timeRemaining == 0

	s.Value = "Game starting!"

	task.wait(2)
	blocco.CanCollide = true

	local mapselect = ReplicatedStorage.Games:GetChildren()
	local choose = Random.new():NextInteger(1, #mapselect)
	local curnum = 0

	for i = 1, #mapselect do
		curnum += 1

		if curnum == choose then
			mapselect[i]:Clone().Parent = workspace
			curmap = mapselect[i].Name
			s.Value = "We'll be playing "..mapselect[i].Name
		end
	end

	task.wait(3)

	--//Start game
	local plrs = Players:GetPlayers()

	for i, player in ipairs(Players:GetPlayers()) do
		pcall(player.LoadCharacter, player)

		task.defer(function()
			local randomNumber = Random.new():NextInteger(1, 32)
			player.Character.Head.CFrame = CFrame.new(workspace.Teleports["Part".. randomNumber].Position)
			player.Character.Parent = workspace.Ingame
		end)
	end

	timeRemaining = 4

	repeat
		timeRemaining -= 1

		s.Value = timeValues[timeRemaining]

		if s.Value == "Go!" then
			blocco.CanCollide = false
		end

		if s.Value == "Ready" then
			Sound2:Play()
		end

		task.wait(1)
	until timeRemaining == 0

	timeRemaining = 120

	repeat
		timeRemaining -= 1

		s.Value = timeRemaining.." seconds left"

		if timeRemaining == 10 then
			Sound1:Play()
		end

		task.wait(1)
	until timeRemaining == 0 or vals.Winner.Value ~= "" or #workspace.Ingame:GetChildren() == 0

	--//End game
	if vals.Winner.Value ~= "" then
		s.Value = vals.Winner.Value.. " has won!"
		Players[vals.Winner.Value].leaderstats.Wins.Value = 	game.Players[vals.Winner.Value].leaderstats.Wins.Value +1
		vals.Winner.Value = ""

		if #workspace.Ingame:GetChildren() == 0 then
			s.Value = "No one has won!"
		end
	else
		s.Value = "No one has won!"
	end

	if vals.Winner.Value =="" then
		Sound1:Stop()
	end

	task.wait(3)

	local ingame = workspace.Ingame:GetChildren()

	for i = 1, #ingame do
		local player = Players:GetPlayerFromCharacter(ingame[i])
		pcall(player.LoadCharacter, player)
	end

	workspace[curmap]:Destroy()
end

None of my attempts worked, but I dont have much experience yet.
Thank you for putting the time into reading this and helping out!

2 Likes

you can enable them when you want there to be confetti and disable it when you don’t want confetti

for example:

local function confetti()
   for _,emitter in pairs(game.Workspace.ConfettiGiver:GetChildren())do 
      if emitter:IsA("ParticleEmitter") then
         emitter.Enabled = true
         task.delay(10,function()
            emitter.Enabled = false
         end)
      end
   end
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.