Trying to Make Table Datastore

I think you need the bindtoclose function then. Add that in to see if that fixes it.

1 Like

Added it in, still doesnt work @DarkDanny04 @CherryMolotov, I used @Cameron4009’s BindToClose function image

On line 32 you have a ; on the first value. Instead, try this:

skin1= plr.skins.NoobSkin.Value,
skin2 = plr.skins.BussinessManSkin.Value;

You literally stole that from my mouth :rage:

That doesn’t make a difference. You can use commas or semi-colons with tables.

Instead of kicking the player in your bind to close, just simply add a wait(3). Just tested it, and it works with a wait(3) in the bind to close.

2 Likes

Ah, that’s our bad, I never see people use semi-colons to be fully honest, good to know!

When you press enter by accident, go me LOL

doesnt work lol
Joined:
Screenshot_1147 !
Then left and rejoined:
Screenshot_1148 !

Btw the print(“Data Saved Successfully”) still isnt printing something to do with the playerremoving function

I see your mistake now. On line 25 you have have “data.NoobSkin” The table doesn’t have that. Instead, it has “data.skin1”

Just to clear it up, change line 25 and 26 to this:

skin1.Value=data.skin1
skin2.Value = data.skin2
1 Like

I think i found the problem, you declared the data as skin2 and skin1 and then when loading you do data.NoobSkin and data.BussinessManSkin, try editing that!

1 Like

Oh lord, I stole your mouth again haha! (Karma is gonna get me)

1 Like

You could also try to automate the process as i tried to say before i accidentally clicked enter with:

-- when loading
for i, v in pairs(data) do
 local value = Instance.new("IntValue", folder)
 value.Name = v.Name
 value.Value = v
end

-- when saving
for i, v in pairs(plr.skins:GetChildren()) do
 data[v.Name] = v.Value
end

It should work, and also make your code a bit cleaner :wink:

1 Like

Hey guess what, IT WORKED! I rejoined after changing the Value to 1 and it saved!
image
Now to test the BussinessMan one real quick :grinning:

That worked aswell! image
That means I should be able to add another skin into the table if I wanted? Like this? image image image

1 Like

You can, or you could follow what i said to make it easier, either way, good luck with further progress!

1 Like

Yep you could do it like that. Be careful with how much data you keep in one table though, because if you have over 180K characters, you will see some errors coming from the datastore.

Thank you so much to everyone who helped me with this, you all are life savers. I’ve learnt so much and now I can make more efficient data stores, Thank guys :smile: image

You are really welcome! :heart:
The forum are here so we could help others, and let them learn from our own knowledge!
We are not here for ourselves, but for others. If you need any other help, you’re more than welcome to HMU on Discord (Maciej#9063) or roblox messages, will gladly help more if (hopefully not) required!

And again, good luck! :wink:

BTW. Do not forget to mark any of the messages as solution to your problem, so people don’t think this is some sort of unsolved detective case :eyeglasses:

1 Like