Right, I’m trying to make a firework launch system that will launch all the fireworks in the game at the same time. Right now it will just cycle through all of the parts in the workspace and I need it to launch them all at the same time. I can do this will several scripts but I’d like it into one so updates can be quicker. I found the code to cycle through on devforum btw.
local event = game:GetService("ReplicatedStorage").Launch
local function firework()
for index, object in next, game.Workspace:GetChildren() do
if object:IsA('Part') then
if object.Name == 'Firework' then --Name of the firework models is "Firework"
--Launch fireworks
end
end
end
event.OnServerEvent:Connect(firework)
you could add them on a table and then after the initial loop is done run another one firing every firework at the same time like:
local event = game:GetService("ReplicatedStorage").Launch
local function firework()
local fireworks={}
for index, object in next, game.Workspace:GetChildren() do
if object:IsA('Part') then
if object.Name == 'Firework' then --Name of the firework models is "Firework"
--Launch fireworks
end
end
for i,firework in pairs(fireworks) do
--idk how you're doing fireworks so considering they have a bindable inside of them
firework.Bindable:Fire()
end
end
event.OnServerEvent:Connect(firework)
I meant, how are you launching them? do every firework have a script inside of them that listens for some bindable in the firework instances or you still dont have any way to move them at all?
So, v1 had a script in each of them but I didn’t want to have to change every script if I updated something so I’m trying to migrate it to a single script to launch them all at the same time. Now I’ve put all the fireworks into a folder if that helps.
Being honest with you that comes with a price though. the more fireworks you have the slower it will take to update, for example 30 fireworks would already be a lot thus making their movement very very slow, so i’m not sure a single script is a good idea, maybe you could handle them on the client so you can actually use a script per firework without having to worry for the server’s fps