Hey everyone so i was wondering since im still new how can i put datastore (or datastore2) in this script:
game.Players.PlayerAdded:connect(function(player)
local folder = Instance.new("Folder",player)
folder.Name = "leaderstats"
local currency1 = Instance.new("IntValue",folder)
currency1.Name = "Cash"
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local stats = tag.Value:WaitForChild("leaderstats")
stats["Cash"].Value = stats ["Cash"].Value + 20
end
end
end)
end)
end)
Idk how to make it work.

2 comments
this is in workspace rn
Have you tried?