I want my firefly parts to initialize, when clicking the Studio ‘Run’ button. However, most of the firefly parts are missing from the subfolders when I manually check them after clicking ‘Run’. ![]()
I tried some debugging, including not running the function. The thing is, these parts already exist in Workspace before clicking on the Studio ‘Run’ button, meaning I am not dynamically creating or cloning them via :Clone(), .new(), or instance.fromExisting(). ![]()
Location of the subfolders: Workspace > base_parts > fireflies > ['sub_folder_name'].
The firefly parts are inside these subfolders.
The code (server script) with comments and prints
:
local workspace_items = {
fireflies = workspace.base_parts.fireflies -- direct indexing the fireflies folder
}
-- function to get and toggle firefly effects
local function toggle_fireflies(boo: boolean)
for _, descendant in pairs(workspace_items.fireflies:GetDescendants()) do
if not descendant.Parent then continue end
print("descendant found:", descendant.Name) -- prints multiple times, as it shall
if descendant:IsA("PointLight") then
print("firefly light found:", descendant.Name) -- prints multiple times, as it shall
descendant.Enabled = boo
print("set boolean to:", boo) -- prints multiple times, as it shall
end
end
end
-- calling the toggle fireflies function
toggle_fireflies(false)