I don't really know how to script data storage, so I watched a video about it and came up with this. The script is almost identical to the one in the video excepting the stringvalues. Everyone commenting the video claim it works but for me it doesn't save. I have API enabled in the game I'm scripting it. Is it because of the stringvalues?
local Data = game:GetService("DataStoreService"):GetDataStore("Loadout_Saving") game.Players.PlayerAdded:Connect(function(plr) local Folder = Instance.new("Folder",game.ServerStorage:FindFirstChild("CurrentLoadout")) Folder.Name = plr.Name local Primary = Instance.new("StringValue",Folder) Primary.Name = "Primary" local Secondary = Instance.new("StringValue",Folder) Secondary.Name = "Secondary" local SavedItems = Data:GetAsync(plr.userId) if SavedItems then Primary.Value = SavedItems.Primary or "None" print(Primary.Value) Secondary.Value = SavedItems.Secondary or "None" print(Secondary.Value) else Primary.Value = "None" Secondary.Value = "None" end end) game.Players.PlayerRemoving:Connect(function(plr) local Saving = {["Primary"] = game.ServerStorage.CurrentLoadout:FindFirstChild(plr.Name).Primary.Value; ["Secondary"] = game.ServerStorage.CurrentLoadout:FindFirstChild(plr.Name).Secondary.Value } Data:SetAsync(plr.userID,Saving) end)