You will reverse the character added and the player removing and don't use the LocalPlayer cause that's for only Local Script
Copy this code
01 | local DataStore = game:GetService( "DataStoreService" ) |
02 | local SlayerStore = DataStore:GetDataStore( "SlayerStore" ) |
05 | game.Players.PlayerAdded:Connect( function (player) |
06 | local leaderstats = Instance.new( "Folder" ,player) |
07 | leaderstats.Name = "leaderstats" |
09 | local Rep = Instance.new( "IntValue" , leaderstats) |
10 | Rep.Name = "Reputation" |
11 | Rep.Value = SlayerStore:GetAsync(player.UserId) or 100 |
15 | player.ChracterAdded:Connect( function (character) |
16 | character:WaitForChild( "Humanoid" ).Died:Connect( function () |
17 | local tag = character.Humanoid:FindFirstChild( "creator" ) |
19 | local player = tag.Value |
22 | local leaderstats = player:WaitForChild( "leaderstats" ) |
23 | leaderstats.Reputation.Value = leaderstats.Reputation.Value + bounty |
29 | game.Players.PlayerRemoving:Connect( function (player) |
30 | SlayerStore:SetAsync(player.UserId, player.leaderstats.Rep.Value) |
Its not tested! I wish will worked!