and the error is still showing up too
The value you set needs to be a string type
Hey Suphi! I love your module, been using it for quite sometime, I was wondering if thereās a way I can determine if a player has joined for the first time and has no data, I need it in order to modify the base template when opening the session without making it yield if data has already been found, Thanks!
PD: I tried using the CreatedTime property of the dataStore but it isnāt really an efficent method for what iām trying to achieve
Yeah, nvm, the solution was really simple, just had to look if the dataStore had any value
Yup or inside the template add a counter that starts at 0 and every time the state turns true add 1
Yeah I was also considering that! however, I came out with a better solution for my case
What if when opening a session it also returns the first data value before reconciling it / using the template?
Just an idea Iād like to see if you update the module anytime soon, thanks for everything
it is and the error is still showing up
Canāt you just, not reconcile it then? You have to call :Reconcile(template) yourself soā¦ just dont
Can you place this above the error
print(type(dataStore.Value[name]))
And tell me what it prints
If you have multiple player added events then you will run into the problem of not knowing the order of these events and thatās why its always best to reconcile during the open that way it does not matter what player added runs first the datastore will always be ready after the open function ends
I do have a so called game. Dm me.
The error is before it prints string so that means the error is coming from another location
did you print the type before setting the value or after?
I think it did it before after
game.Players.PlayerAdded:Connect(function(player)
task.spawn(function()
local dataStore = DataStoreModule.new("PlayerData", player.UserId)
dataStore.StateChanged:Connect(stateChanged)
stateChanged(dataStore.State, dataStore)
end)
task.spawn(function()
local dataStore = DataStoreModule.new("PlayerData", player.UserId.."-Plot1")
end)
end)
In the script where I use local dataStore = DSM.find("PlayerData", player.UserId.."-Plot1")
it seems like it canāt find they key, why not? The player.UserId
key works
Are you using it in playeradded?
Iām using the .find() in another script in PlayerRemoving.
the only 3 ways find would not work is if
- you destroyed it somewhere else
- bindtoclose ran first and destroyed it before PlayerRemoving was fired
- you never called new()