I'm currently attempting to store a StringValue inside of the DataStore so when the player leaves, the datastore will still be the same. My code is below, as well as the error I'm receiving.
local DataStoreService = game:GetService("DataStoreService")
local data= DataStoreService:GetDataStore("data")
game.Players.PlayerAdded:connect(function(plr)
local key = "user_"..plr.userId
local database = Instance.new("IntValue",plr)
database.Name = "leaderstats"
local data= Instance.new("StringValue",database)
data.Name = "Level"
data.Value = Level:GetAsync(key)
function onTagsChanged(plr, tags)
end
data.Changed:connect(function() data(key, data.Value) end)
end)
The error:
21:05:02.808 - ServerScriptService.Script:16: bad argument #3 to 'Value' (string expected, got nil) 21:05:02.809 - Stack Begin 21:05:02.809 - Script 'ServerScriptService.Script', Line 16 21:05:02.809 - Stack End

1 comment
Hope I helped.