Hello, I am currently trying to save a table for key binds onto a Datastore, However, when I use dataStore:SetAsync(Player_User_Id,KeyBinds_List) it doesn’t save it at all.
Here is the code I am using;
local DataStoreService = game:GetService("DataStoreService")
local KeyBinds_DataStore = DataStoreService:GetDataStore("KeyBinds_DataStore")
game.Players.PlayerRemoving:Connect(function(player)
local Player_User_Id = "Player_"..player.UserId
local success, errormessage = pcall(function()
local KeyBinds_List = {}
print("1")
local Ship_Controls = player.PlayerGui.SettingsGui.Frame.ShipControl
print("2")
for name,value in pairs(Ship_Controls:GetAttributes()) do
table.insert(KeyBinds_List,name)
table.insert(KeyBinds_List,value)
end
print("3")
KeyBinds_DataStore:SetAsync(Player_User_Id,KeyBinds_List)
print("4")
end)
if success then
print("Succesfully Saved")
else
print("Failed to save")
print(errormessage)
end
end)
I tried using a pcall function and using prints as you can see above and the problem seems to occur with the SetAsync. Do any of you know what might be causing the problem? Also, I am aware it looks like I am trying to get attributes from the client’s side, but I made it so the attributes are located server side.