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

Why does this stop?

Asked by
ItsMeKlc 235 Moderation Voter
9 years ago

Everything here works, except anything past line 14 wont run, why?

JumpValu = 50


function update()
    print("upd8")
    JumpValu = 50
    for i=1,8 do
    local StickerValue = stickers["Sticker"..i].Value
    if StickerValue~="" and StickerValue~="LOCKED" then
        if game.ServerStorage.assets.stickers:WaitForChild(StickerValue):FindFirstChild("Jump") then
            JumpValu = JumpValu + game.ServerStorage.assets.stickers:WaitForChild(StickerValue):FindFirstChild("Jump").Value
        end
    end
    end
    print("lol")
end

2 answers

Log in to vote
1
Answered by 9 years ago

When you call WaitForChild, you're checking for the sticker value instead of the sticker. Just change it to check for the sticker you're searching for.

The code you posted might not be sufficient to find a solution. I don't know what you're storing in the table, or how they might be indexed, so that might also be a problem. Let me know if this code doesn't work.

function update()
    print("upd8")
    JumpValu = 50
    for i=1,8 do
    local sticker = stickers["Sticker"..i]
    local StickerValue = sticker.Value
    if StickerValue~="" and StickerValue~="LOCKED" then
        if game.ServerStorage.assets.stickers:WaitForChild(sticker):FindFirstChild("Jump") then
            JumpValu = JumpValu + game.ServerStorage.assets.stickers:WaitForChild(sticker):FindFirstChild("Jump").Value
        end
    end
    end
    print("lol")
end

update()


Ad
Log in to vote
-1
Answered by 9 years ago

You did not call the function. Do this:

JumpValu = 50

function update()
    print("upd8")
    JumpValu = 50
    for i=1,8 do
    local StickerValue = stickers["Sticker"..i].Value
    if StickerValue~="" and StickerValue~="LOCKED" then
        if game.ServerStorage.assets.stickers:WaitForChild(StickerValue):FindFirstChild("Jump") then
            JumpValu = JumpValu + game.ServerStorage.assets.stickers:WaitForChild(StickerValue):FindFirstChild("Jump").Value
        end
    end
    end
    print("lol")
end

update()

0
No that's not the issue. I do call the function, I just didn't list it here. The problem is that on line 15 nothing happens ItsMeKlc 235 — 9y

Answer this question