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

DataStore Error Attempt to index local 'VaribleName' (A nil value) Line 507?

Asked by 6 years ago

The Issue I'm getting is 00:34:31.785 - ServerScriptService.Clothing_DataStore:507: attempt to index local 'HotAirBalloon' (a nil value)

PasteBin For the Code

0
Gears["Hot Air Balloon"] ? , Is it good? . That was long code e.e User#17685 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

All of your code of just dealing with bool values? You should have seen how much code has been duplicated and changed the design.

There are far better ways of storing data than just putting value objects into the players model.

If you need to use these value objects create a function to make them. You hard code everything which is not how things should be done. Instead use loops and the correct table structures to setup, save and load data.

You error could be down to a lot of things in your code as it is not easy to add or remove itemst from a array without changing how other data is loaded.

In addition to this you have a lot of infinate loops which will cause errors and other issues if the player leaves the games.

An auto save should not be linked per player and should go through and save player data who are in the game.

There is a lot that needs to be looked at in your code and this is just one solution. There are better solutions which you should look into and this code does not account for any data store errors. I would also reccomend that you split this code up into modules.

As this code uses a differnt save / load format I have changed the key prefix to act as a new save.

Example:-

001local statsSetup = {
002    Shirts = {
003        "RedShirt"
004    },
005    Hats = {
006        "BlackValk Shades",
007        "The Classic ROBLOX Fedora"
008        -- add other hats here
009    },
010    Faces = {
011        "Bandage",
012        "Beast Mode"
013        -- add other faces here
014    },
015    Titles = {
View all 116 lines...

This is a lot of code to look at but please comment if you do not understand how it works.

0
I understand all of it. Sorry I was away for a few days. namerplz 42 — 6y
Ad

Answer this question