Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I change properties of all childrens and why does it print something I don't want? No errors

Asked by 4 years ago
01local ChatGui = game.Players:WaitForChild("DevSeveral").PlayerGui
02local Part = script.Parent
03local Blackoutthingy = game.Workspace.Black1:GetDescendants()
04Part.ClickDetector.MouseClick:Connect(function(pussy2)
05    Part.BrickColor = BrickColor.new("Bright yellow")
06    Part.Anchored = true
07    Part.Transparency = .2
08    wait(2)
09    ChatGui:Destroy()
10    wait(2)
11    if Part.BrickColor == BrickColor.new("Bright yellow") then
12        print('Part is bright yellow')
13        wait(.01)
14        print('Changing...')
15        Part.BrickColor = BrickColor.new("Alder")
View all 29 lines...

Errors: none

I want the parts that are the children of Black1 to cancollide be true and for transparency go to 0 at line 20, And then go back to transparency 1 and cancollide false also, why does it print this 'function: 0x0de61314625aab51 table: 0x6a71a87bcce0e3a1' at the end instead of what I want it to print?

0
well if you problem is only what ever its printing then the problem is that you are trying to print out a table and not an integer, if you want the contents of the table then you should use a loop to go through the table and print each index cheetahjad -4 — 4y
0
Show your whole script User#30567 0 — 4y
0
you would use a for loop to fix both things will post an answer soon Natsudragneel2500 80 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

You can't print tables. If you want to print all the contents inside the table then do this:

1for i,v in pairs(Blackoutthingy) do
2    print(v.Name)
3end
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

To make all for the descendants of black out thingy change you would use a for loop you can read about that here Loops

01local DevInfo = "DEV INFO ONLY: "
02for i, Descendant in pairs(Blackoutthingy) do
03         if Descendant.ClassName == "Part"--to check if its a part
04        if Descendant.BrickColor == BrickColor.new("Bright yellow") then
05            print('Part is bright yellow')
06 
07            print('Changing...')
08            Descendant.BrickColor = BrickColor.new("Alder")
09 
10            Descendant.BrickColor = BrickColor.new("White")
11            print('BLACKOUT INCOMING!')
12 
13            Descendant.transparency = 0
14            Descendant.Cancollide = true
15            print('Blackout will end in 5 seconds')
View all 26 lines...

hope this is helpful to you

0
line 37 doesnt work DevSeveral 19 — 4y
0
you have to edit it to fit ur code what exactly is the problem Natsudragneel2500 80 — 4y

Answer this question