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

Why are tables returning nil for me?

Asked by 7 years ago

This is in a local script, and it is just a table of all the things to preload. Apparently gameInfo is nil. What did I do wrong? .-.

-- Protori v0.01 local ContentProvider = game:GetService("ContentProvider")

local gameInfo = {

loadInfo = {

    loadscreenText = {
    'Leaving my weapons by the door..','Tying the belts..','Grabbing blocks of cinder to break..','Cleaning the arena floors..',
    'Opening the dojo doors..','Waking up the instructor..','Grabbing the bow staffs off the racks..'
    },

    tipText = {
        'TIP: Go to the instructor to check out your missions while waiting for your turn!','TIP: Try completing the obby to gain extra coins!',
        'TIP: Run from your opponent when you see a white star flash above their head!','TIP: Open boxes to earn new moves!',
        'TIP: Want more relics? Buy VIP to get 3x relics from leveling up, and many other perks!',
        'TIP: Watch your stamina bar in battle, as it can deplete and leave you without any attacks!',
        'TIP: Want free coins? Buy VIP to get 1000 free coins!', 'TIP: Want more XP? Buy VIP to get 1000 free XP!',
        'TIP: Put together different moves to create an effective strategy against your opponent!',
        'TIP: Every move has downsides, just as it has upsides to it. Use this to your advantage!'
    },

    loadItems = { -- Preloaded assets go here
        Images = {
            'rbxassetid://1257483979',
        },
        Sounds = {

        },
    },

},

}

for _,loadingItems in next,gameInfo.loadItems.Images do

local success, message = pcall(preloadImage)
if success then
    script.Parent.MainFrame.LoadText.Text = gameInfo.loadInfo.tipText[math.floor(math.random(1,#loadStuff.loadInfo.tipText))]
else 
    warn('An image was not preloaded correctly!')
end
wait(0.05)

end

function preloadImage(item) ContentProvider:PreloadAsync(item) end

0
And this happens for just about every table i create. Protori 0 — 7y
0
You need to have the function before it was called. thesit123 509 — 7y

Answer this question