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

(ANSWERED) Very strange bug involving datastores and module scripts?

Asked by 4 years ago
Edited 4 years ago

I think this may be a roblox bug, but i dont really know if it is or not. I have a datastore system that works fine, it saves, and etc. And then i have a Module script system which also works, But this is where my problem is..

LOCAL SCRIPT IN A GUI:

local info = statsProvider.getKeyInfo("KEY_"..keyValue.Value)
if info == nil then return end
keyIcon.Image = info[2]
equipToolFrame.Info1.TextL.Text = ("Key: ".. info[1])

STATS PROVIDER:

keyInfo = {
    --[[
        Magical - Common
        Legend - Uncommon
        Mystical - Rare
        Myth - Legendary
    --]]

    KEY_Venom = {
        "Venom", --NAME
        "rbxassetid://3447071395", --ICON
        "Magical", --Rarity
        "4", --STRENGTH
    },

    KEY_Circlet = {
        "Circlet", --NAME
        "rbxassetid://3453811947", --ICON
        "Magical", --Rarity
        "3", --STRENGTH
    },


}

local module = {}

    module.getKeyInfo = function(item)
        return keyInfo[item]
    end


return module

statsProvider = the module script, (called it correctly, using require.) i tried removing the line,

if info == nil then return end

and it still didnt work. My problem is, is that the script isn't getting "info" and no error is printed in the output.. how do i know its not getting the "info"?

keyIcon.Image = info[2]
equipToolFrame.Info1.TextL.Text = ("Key: ".. info[1])

those lines don't work... The image is not appearing, and it should, i to see if the keyIcon is visible and it is.. The strange part happens when, it does retrieve the data, and the lines;

keyIcon.Image = info[2]
equipToolFrame.Info1.TextL.Text = ("Key: ".. info[1])

Do work, but only if the datastore key is: "Testing8.4", any other key DOESNT work..? Wtheck is up with this? * one reason why I think it may be a roblox bug is because this wasn’t a problem before I updated studio recently

0
Can you post the entire script? These small segments of code alone make little to no sense. climethestair 1663 — 4y
0
I doubt anything else in the code will help with that, the only other parts is the local function functionname(), end, etc. i can post the statsProvider, that may be able to help, hold on ImperiumDomini2 39 — 4y
0
What you want to do is put print() and have the code print out info everywhere and certain values so you can see where it becomes nil or where your error is occuring exactly to help narrow down what is wrong deth836231 142 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

The line "if info == nil then return end" messed it up somehow. I removed it and added a value in the table "KEY_None" which solved it.. I don't even know how or why but, thanks for the help everyone!

Ad

Answer this question