How do i delete a certain variable from a datastore

to be clear, i dont want it to FULLY be gone from all players. what im trying to make here, is that ill make a “kills” variable for each class, which, for every one of those classes youll be able to wipe your progress, just deleting that variable. now, i do kiiiind of know how to make variables in the datastore, i can just do

table.insert(playerdata, {[plr.class.Value.."KILLS"] = 0}) -- playerdata is gonna be saved, plr.class is the class value (string) please tell me if this will work because im not that sure

so, now if i wanna delete this variable, can i just do playerdata.classnamehereKILLS = nil?? or will just make it nil and not delete it?
-forgot to mention this, i tried using table.remove but it seemed to not even do anything. also, tried doing table[classnamehereKILLS] = nil buut it simply set it to nil and didnt destroy it.

1 Like

Do you want to reset plr.class.Value…“KILLS” value or just remove it?

probably just remove it so that it doesnt show up in the gui

1 Like

If you want it to not show on your gui, I think you can set it to nil and then check if the value is nil, it hides that stat on the gui

1 Like

oh yeah, that will definitely work. although if anyone does know how to entirely wipe out the variable from existence… please reply anyway. for now ill make this the solution tho

1 Like

Any non-existant value is basically nil on tables, so when you set a value to nil, It basically removes it

oh? didnt really know that. always thought that every variable thats saved as nil just doesnt store anything but still exists.

1 Like