[SOLVED] Help with DataStore2

I’m trying to switch a server over to DataStore2. I got most of the datastores working, including levels, experience, and currency. However, when I try to save my tag value something goes wrong. More specifically I think it is when I load back in. I put some print statements in my code to see if I could figure out what was happening, but I can’t. The data is successfully updated and saved when I leave, but it returns to 0 when I rejoin. It’s confusing because my other datastores work just fine.

--My tag datastore
    local tagsStore = DataStore2("tags", player)
    local tags = Instance.new("NumberValue")
    tags.Name = "Tags"
    tags.Value = tagsStore:Get(0)
	print("Got tags from datastore2 for", player ,"found", tags.Value)
    tags.Parent = leaderstats
    tagsStore:OnUpdate(function(newTags)
		print("Updating new tags for", player)
		tags.Value = newTags
		print(player,"Now has", tags.Value)
    end)

Server Console
Screen Shot 2020-03-25 at 10.35.47 PM

I am sure you will probably ask to see something else, just let me know how I can help troubleshoot. Thanks

Edit: I isolated my datastore script in another server and tested it out, so there’s not anything wrong with my script. It is due to something else in the server, I have no idea what it could be though.

Edit2: I solved it by making the key something else. Weird stuff.

1 Like