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 3 years ago
local ChatGui = game.Players:WaitForChild("DevSeveral").PlayerGui
local Part = script.Parent
local Blackoutthingy = game.Workspace.Black1:GetDescendants()
Part.ClickDetector.MouseClick:Connect(function(pussy2)
    Part.BrickColor = BrickColor.new("Bright yellow")
    Part.Anchored = true
    Part.Transparency = .2
    wait(2)
    ChatGui:Destroy()
    wait(2)
    if Part.BrickColor == BrickColor.new("Bright yellow") then
        print('Part is bright yellow')
        wait(.01)
        print('Changing...')
        Part.BrickColor = BrickColor.new("Alder")
        wait(2)
        Part.BrickColor = BrickColor.new("White")
        print('BLACKOUT INCOMING!')
        wait(3)
        Blackoutthingy.transparency = 0
        Blackoutthingy.Cancollide = true
        print('Blackout will end in 5 seconds')
        wait(5)
        Blackoutthingy.transparency =  0
        Blackoutthingy.Cancollide = true
        print('Blackout ended')
        print('DEV ONLY INFO: ',Blackoutthingy)
    end
end)

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 — 3y
0
Show your whole script User#30567 0 — 3y
0
you would use a for loop to fix both things will post an answer soon Natsudragneel2500 80 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

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

for i,v in pairs(Blackoutthingy) do
    print(v.Name)
end
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 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

local DevInfo = "DEV INFO ONLY: "
for i, Descendant in pairs(Blackoutthingy) do
         if Descendant.ClassName == "Part"--to check if its a part
        if Descendant.BrickColor == BrickColor.new("Bright yellow") then
            print('Part is bright yellow')

            print('Changing...')
            Descendant.BrickColor = BrickColor.new("Alder")

            Descendant.BrickColor = BrickColor.new("White")
            print('BLACKOUT INCOMING!')

            Descendant.transparency = 0
            Descendant.Cancollide = true
            print('Blackout will end in 5 seconds')

                Descendant.Transparency =  0
            Descendant.Cancollide = true
            print('Blackout ended')
            print('DEV ONLY INFO: ', Descendant.Name) --if you only wanted to print the name
                --if u wanted to add it to a list 
                DevInfo = (DevInfo.." "..Decscendant.Name..","')--adds to list with each loop

        end
        print(DevInfo)--this would print the full list
end

hope this is helpful to you

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

Answer this question