Im trying to find have the value of every single child without having to put the another script every single time. Im not sure if this will work
local coinsGiven = player.CoinNExpGiverForAll:GetChildren("CoinsGivenInStageOne").Value
CoinNExpGiverForAll is the folder and then, as I add more stages I will do
local coinsGiven = player.CoinNExpGiverForAll:GetChildren("CoinsGivenInStageOne", "CoinsGivenInStageTwo", "CoinsGivenInStageThree").Value
and so on. I have another idea but because im new to scripting i dont know if it will work.
local coinsGiven = player.CoinNExpGiverForAll.Children.Value
Because I know it works if children was Parent I was wondering if it would work the other way as well. All I need is a short clear way to put every child that is in the folder “CoinNExpGiverForAll” in one variable.
Sorry that I didn’t explain prior to you making the script but the reason why I need that is because of this.
if MarkerplaceService:UserOwnsGamePassAsync(player.UserId,DoubleCoingamePassID) then
coinsGiven *= 2
end
then if the player has that gamepass then no matter which stage they are in the amount of coins they get will always get doubled. This is why I needed coinsGiven to be defined
I assume you want to add the coins given in all stages. If so, then you can do this.
local coinsGiven = 0
for _, coinsGivenInStage in pairs(player.CoinNExpGiverForAll:GetChildren()) do
coinsGiven += coinsGivenInStage.Value
end
-- do stuff with 'coinsGiven'