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

It says the part is in the table when it clearly is not?

Asked by 7 years ago
Edited 7 years ago

I'm using prints to check what's going wrong in the script, and it only prints 1 and 3 in the output so obviously the script is thinking the ore is a part of the table, when as you can see, it clearly is not. I really need help with this, as I've been asking this for over a day now.

Here is the output.

local done = {}
script.Parent.Touched:connect(function(p)
    if p:FindFirstChild('oretag') then
        if p:FindFirstChild("Shinifier").Value < p:FindFirstChild("ShinifierL").Value then
            print("1")
            local canbeupgraded = false
            for _, value in pairs(done) do
                if p == value then
                    canbeupgraded = false
                else
                    canbeupgraded = true
                    print("2")
                end
            end
            print('3')
            if canbeupgraded == true then
                p.money.Value = p.money.Value + script.Parent.Upgrade.Value
                table.insert(done, #done + 1, p)

                p:FindFirstChild("Shinifier").Value = p:FindFirstChild("Shinifier").Value + 1
                print('4')
                canbeupgraded = false
            end
            canbeupgraded = false
        else
            script.Parent.BrickColor = BrickColor.new("Bright red")
            wait(0.1)
            script.Parent.BrickColor = BrickColor.new("CGA brown")
        end
    end
end)
0
Include the output. cabbler 1942 — 7y
0
Yes, we need the output Lord_Hagenost 40 — 7y
0
alright Operation_Meme 890 — 7y
0
1) What is "the ore"? 2) What is supposed to be in the table? 3) What is your script overall trying to do? Monsieur_Robert 338 — 7y

Answer this question