Change multiple parents a time

Hello,
I am trying to change multiple parents at a time.
I have a content bin and it has multiple lighting effects that I want to go into lighting.

Basically meaning doing a simple i, in pairs, which I did try and it still wouldn’t work
any ideas?

2 Likes

Well doing a for loop is the best way to do this
So something like

for _, effect in pairs(contentbin:GetChildren()) do
    effect.Parent = game.Lighting
end

There are other methods but this should work just fine

1 Like

There was an error, since its multiple effects that are going into lighting. The effects are all different
names.
12:42:21.669 Workspace.Im***** 🏝 - Light.Im*****Handler:36: attempt to call a nil value - Server - ImmerseHandler:36 12:42:21.670 Stack Begin - Studio 12:42:21.670 Script 'Workspace.Im*****🏝 - Light.Im*****Handler', Line 36 - function loadtheme - Studio - Im*****Handler:36 12:42:21.670 Script 'Workspace.Im***** 🏝 - Light.Im*****Handler', Line 54 - Studio - Im*****Handler:54 12:42:21.670 Stack End - Studio

Their names should not matter
for _, effect - - every time it loops ‘effect’ is changed to the next value
What are the values you are looping through?

1 Like

Wait, I just realised. The reason the value is nil is because its doing get children 2 times.

1 Like

Now, I have another issue though…

Unhandled Promise rejection:
Unexpected response when fetching game name, no game info
CoreGui.RobloxGui.Modules.Common.GetGameNameAndDescriptionNew:24
CorePackages.Packages._Index.evaera_roblox-lua-promise.roblox-lua-promise:151 function runExecutor
CorePackages.Packages._Index.evaera_roblox-lua-promise.roblox-lua-promise:160

1 Like

Thats a roblox thing it happens when you haven’t published your game
Just ignore it, It doesn’t do anything

1 Like

How would I make it so it changed the clock time with module scriptCapture

return {
[‘Settings’] = {
[‘ClockTime’] = 14,
[‘GlobalShadows’] = true,

},
}

1 Like

Funny enough…another loop!
but this time we’ll be using the index parameter.
You can actually check properties like you would in a table.
So something like:

for key, value in pairs(thetable['Settings'] do
   game.Lighting[key] = value
end
1 Like

There is and error it would be ) after the ] correct?

for key, value in pairs(thetable['Settings']) do
   game.Lighting[key] = value
end
2 Likes

Oh yes there would be my bad
Didn’t write it in studio lol

1 Like

Error again.
Settings is not a valid member of ModuleScript "Workspace.Im***** 🏝Light.Resources.LightingResourses.Realism

1 Like

How are you getting the Settings?
From the error it looks like you’re trying to do Realism.Settings on the module script itself which won’t work

1 Like

the settings is inside the realism script
Capture

You’re doing:

local realism = require(whereitsstored.Realism)

right?

im doing this, funny enough it was named thetable before.

local thetable = Resources.LightingResourses[currenttheme]

Its fixed, thank you so much!!!

Except roblox lua promise is really annoying me.

It doesn’t bother me but maybe something in this post can help you

thank you so much. I really appreciate your help!