I've been trying to save my Data using DataStores but I'm not sure where to start?
Leaderstats
local DataStoreService = game:GetService("DataStoreService")
local ds = DataStoreService:GetDataStore("KillsDataSaver")
game.Players.PlayerAdded:Connect(function(plr)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = plr
local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Parent = stats
local deaths = Instance.new("IntValue")
deaths.Name = "Deaths"
deaths.Parent = stats
local gems = Instance.new("IntValue")
gems.Name = "Gems"
gems.Parent = stats
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Parent = stats
plr.CharacterAdded:connect(function(char)
local humanoid
repeat
humanoid = char:FindFirstChild("Humanoid")
wait()
until humanoid
humanoid.Died:connect(function()
deaths.Value = deaths.Value + 1
local tag = humanoid:FindFirstChild("creator")
if tag then
local killer = tag.Value
if killer then
killer.leaderstats.Kills.Value = killer.leaderstats.Kills.Value + 1
end
end
end)
end)
end)

1 comment
I have, I'm looking for a way to save all Stats not just one. If I try using that w/ all of those it will just add my request to Queue.