#help with kill for cash system

1 messages · Page 1 of 1 (latest)

mental pumice
#

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("MoneyStats")

game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Wins = Instance.new("IntValue", leaderstats)
Wins.Name = "Wins"
Wins.Value = 0
local Cash = Instance.new("IntValue", leaderstats)
Cash.Name = "Cash"
Cash.Value = 0

local Data = DataStore:GetAsync(Player.UserId)
if Data then
    Wins.Value = Data.Wins
    Cash.Value = Data.Cash
end

end)

game.Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, {
["Wins"] = Player.leaderstats.Wins.Value;
["Cash"] = Player.leaderstats.Cash.Value;
})
end) and game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()
Player.Character.Humanoid.Died:Connect(function()
local humanoid = Player.Character:WaitForChild("Humanoid")
local tag = humanoid:FindFirstChild("creator")
if tag and tag.Value then
local PlayerName = tag.Value
local killer = game:GetService("Players"):FindFirstChild(PlayerName.Name)
killer.leaderstats.Cash.Value += 100
end
end)
end)
end) andlocal ds = game:GetService("DataStoreService"):GetGlobalDataStore()
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.UserId
local save1 = plr.leaderstats.Cash

local Saved = ds:GetAsync(plrkey)
if Saved then
    save1.Value = Saved[1]
else
    local NumberForSaving = {save1.Value}
    ds:GetAsync(plrkey, NumberForSaving)
end

end)

game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync("id_"..plr.UserId, {plr.leaderstats.Cash.Value})
end) are all of the scripts

#

can someone tell me whats wrong with the script?

#

u get queued into a match and it isnt giving money to the killer

warm marsh
#

ask ai

lean sedgeBOT
#

studio** You are now Level 1! **studio

mental pumice
#

Bro