I want to make it to where the player gets Rep everytime they kill someone but it does not work.
local DataStore = game:GetService("DataStoreService")
local SlayerStore = DataStore:GetDataStore("SlayerStore")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local Rep = Instance.new("IntValue", leaderstats)
Rep.Name = "Reputation"
Rep.Value = SlayerStore:GetAsync(player.UserId) or 100
print("Loaded!")
end)
game.Players.PlayerRemoving:Connect(function(player)
SlayerStore:SetAsync(player.UserId, player.leaderstats.Rep.Value)
print("Saved!")
end)
game.Players.LocalPlayer.ChracterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
local player = tag.Value
local bounty = 20
local leaderstats = player:WaitForChild("leaderstats")
leaderstats.Reputation.Value = leaderstats.Reputation.Value + bounty
end
end)
end)
