So i am aware my script either saves too many values for the datastore to handle. How can I get a lot of values to save?
local DataStore = game:GetService("DataStoreService")
local pb = DataStore:GetDataStore("PistolBullets")
local pm = DataStore:GetDataStore("PistolMag")
local cps = DataStore:GetDataStore("Caps")
local bnty = DataStore:GetDataStore("Bounty")
local hp = DataStore:GetDataStore("Health")
game.Players.PlayerAdded:Connect(function(player)
local pistolbullets = player:WaitForChild("pistolbullets")
local pistolmag = player:WaitForChild("pistolmag")
local caps = player:WaitForChild("caps")
local bounty = player:WaitForChild("bounty")
local health = player:WaitForChild("hp")
pistolbullets.Value = pb:GetAsync(player.UserId) or 100
pistolmag.Value = pm:GetAsync(player.UserId) or 0
caps.Value = hp:GetAsync(player.UserId) or 0
bounty.Value = cps:GetAsync(player.UserId) or 0
health.Value = hp:GetAsync(player.UserId) or 100
game.Players.PlayerRemoving:Connect(function(player)
pb:SetAsync(player.UserId, pistolbullets.Value)
pm:SetAsync(player.UserId, pistolmag.Value)
cps:SetAsync(player.UserId, caps.Value)
bnty:SetAsync(player.UserId, bounty.Value)
hp:SetAsync(player.UserId, health.Value)
if bounty.Value > 0 then
bnty:SetAsync(player.UserId, bounty.Value)
end
end)
end)

3 comments
better off using a dictionary and a single datastore rather than multiple datastores
You can do that, but like what theking48989987 said, a single datastore would be more reasonable than multiple.
Yes, It's best to use pcall().it will help prevent the Script from causing further issues if the requested Data Retrieval fails