#Hi, pls help me i need add "Cash" in leaderboard if i kill player

88 messages · Page 1 of 1 (latest)

lost crow
#
game.Players.PlayerAdded:Connect(function(Player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = Player
    
    local cash = Instance.new("IntValue")
    cash.Parent = leaderstats
    cash.Name = "Cash"
    

end)

game.Players.PlayerAdded:Connect(function(plr)

    local stats = Instance.new("Folder", plr)
    stats.Name = "leaderstats"

    local kills = Instance.new("IntValue", stats)
    kills.Name = "Kills"
end)
wanton cliff
#

do that

lost crow
#

sry

sacred boltBOT
#

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

wanton cliff
#

wait what the script changed oh ok

#

do you have a killing system?

lost crow
#

no

#

i change code

#
game.Players.PlayerAdded:Connect(function(Player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = Player
    
    local cash = Instance.new("IntValue")
    cash.Parent = leaderstats
    cash.Name = "Cash"
    
    local kills = Instance.new("IntValue", leaderstats)
    kills.Name = "Kills"
  end)
#

it's work but kill's don't work

wanton cliff
#

how does someone get a kill

wanton cliff
lost crow
#

hm

#

i don't understand question

wanton cliff
lost crow
#

weapon's

#

i send gif

wanton cliff
#

create another script for the kill system

lost crow
#

???

wanton cliff
#

you need a script to know if someone kills you

lost crow
#

you can send?

wanton cliff
#

im trying to do something not sure if it wokrs

lost crow
#

np

steep vale
#

wait you want to get money when you kill player or when to money on the ground

lost crow
#

get money when you kill player

steep vale
#

you have a script that drops money right?

lost crow
#

yes

steep vale
#

do you want to use money or kills

lost crow
#
local char = script.Parent
local human = char:WaitForChild("Humanoid")
local humanRoot = char:WaitForChild("HumanoidRootPart")

local cash = game.ReplicatedStorage:WaitForChild("Cash")

human.Died:Connect((function()
    
     local moneyDropped = math.random(10,30)
     local cashClone = cash:Clone()
     cashClone.BillboardGui.amountOfCash.Value = moneyDropped
     cashClone.BillboardGui.amount.Text = "$" .. tostring(moneyDropped)
     
     cashClone.Parent = game.workspace
     
     cashClone.CFrame = humanRoot.CFrame + (humanRoot.CFrame.LookVector + Vector3.new(3,3,3))
     
     
     
end))
lost crow
wanton cliff
#
local humanoid, killer,killerplr
game.Players.PlayerAdded:Connect(function(plr)
  plr.CharacterAdded:Connect(function()
    plr.Character.Humanoid.Died:Connect(function()
        humanoid = plr.Character:WaitForChild("Humanoid")
        killer = humanoid:FindFirstChild("creator")
        if killer then
            killerplr = game.Players:FindFirstChild(killer.Value.Name)
            killerplr.leaderstats.Cash += 100 -- whatever cash you wanna add
            killerplr.leaderstats.Kills += 1
        )
    )
)
)

maybe this will work

sacred boltBOT
#

studio** You are now Level 11! **studio

wanton cliff
#

took so long

lost crow
#

not work

sacred boltBOT
#

studio** You are now Level 2! **studio

steep vale
lost crow
steep vale
#

did you test it in a player?

lost crow
#

yes

#

and npc

steep vale
#

i dont think it would work on npc

lost crow
#

It shouldn't work either

#

only player's

steep vale
#

did you test it on player?

lost crow
#

yes

steep vale
#

hmmm

lost crow
#

?

steep vale
#

i dont know what is the problem

#

oh i found it

lost crow
#

oh yes?!

steep vale
#
game.Players.PlayerAdded:Connect(function(plr)
  plr.CharacterAdded:Connect(function()
    plr.Character.Humanoid.Died:Connect(function()
        local humanoid = plr.Character:WaitForChild("Humanoid")
        local killer = humanoid:FindFirstChild("creator")
        if killer then
            local killerplr = game.Players:FindFirstChild(killer.Value.Name)
            killerplr.leaderstats.Cash += 100 -- whatever cash you wanna add
            killerplr.leaderstats.Kills += 1
        end
    )
)
)
#

he used ) rather than end

#

lol

#

try this

lost crow
#

okey

#

i need put it script in???

steep vale
#

i think you can put it workspace

lost crow
#

okay i put it in workspace

#

and it don't work

steep vale
#

did you try it on npc or player?

lost crow
#

i test in on player

#

you can join in vc?

steep vale
#

did you get any error?

lost crow
#

hm

steep vale
lost crow
#

moneyrain

sacred boltBOT
#

studio** You are now Level 3! **studio

steep vale
#

dumb me

#
game.Players.PlayerAdded:Connect(function(plr)
  plr.CharacterAdded:Connect(function()
    plr.Character.Humanoid.Died:Connect(function()
        local humanoid = plr.Character:WaitForChild("Humanoid")
        local killer = humanoid:FindFirstChild("creator")
        if killer then
            local killerplr = game.Players:FindFirstChild(killer.Value.Name)
            killerplr.leaderstats.Cash += 100 -- whatever cash you wanna add
            killerplr.leaderstats.Kills += 1
        end
    end)
  end)
end)
#

try this

lost crow
#

again

#

don't work

#

and on player don't work

steep vale
lost crow
#

???

#

no i can't

steep vale
#

why

lost crow
#

how i can do it?

steep vale
#

copy it and paste it here

lost crow
#

you can join in vc?

#

i show you my screen

steep vale
#

k