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

Output comes up with "in 'pairs'(table expected, got nil)" What is wrong? [closed]

Asked by 3 years ago
Edited by JesseSong 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
one = {script.Parent.One:GetChildren()}
two = {script.Parent.Two:GetChildren()}
three = {script.Parent.Three:GetChildren()}
four = {script.Parent.Four:GetChildren()}
five = {script.Parent.Five:GetChildren()}

function Blue() 
    for i,v in pairs(p) do
        v.BrickColor = BrickColor.new("Electric blue")
    end
end

function Green()    
    for i,v in pairs(p) do
        v.BrickColor = BrickColor.new("Lime green")
    end
end

function Yellow()   
    for i,v in pairs(p) do
        v.BrickColor = BrickColor.new("New Yeller")
    end
end

function Red()  
    for i,v in pairs(p) do
        v.BrickColor = BrickColor.new("Really red")
    end
end

function Black()    
    for i,v in pairs(p) do
        v.BrickColor = BrickColor.new("Black")
    end
end

while true do
    local p = one
    Blue()
    wait(0.25)
    Green()
    wait(0.25)
    Yellow()
    wait(0.25)
    Red()
    wait(0.25)
    Black()
    wait(0.5)
end

while true do
    local p = two
    Green()
    wait(0.25)
    Yellow()
    wait(0.25)
    Red()
    wait(0.25)
    Black()
    wait(0.25)
    Blue()
    wait(0.5)
end

while true do
    local p = three
    Yellow()
    wait(0.25)
    Red()
    wait(0.25)
    Black()
    wait(0.25)
    Blue()
    wait(0.25)
    Green()
    wait(0.5)
end

while true do
    local p = four
    Red()
    wait(0.25)
    Black()
    wait(0.25)
    Blue()
    wait(0.25)
    Green()
    wait(0.25)
    Yellow()
    wait(0.5)
end

while true do
    local p = five
    Black()()
    wait(0.25)
    Blue()
    wait(0.25)
    Green()
    wait(0.25)
    Yellow()
    wait(0.25)
    Red()
    wait(0.5)
end
0
First of all, please format your code. Second, please give us more details on your question. We can't completely understand all this code just from the title. So give us more details. Soban06 410 — 3y
0
There is this thing you click, it has the picture of Lua logo, it wil generate a field where you can paste your code so it looks better, use that please. SpeedyTV_1 88 — 3y

Closed as Non-Descriptive by Soban06 and JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?