Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Award Points To Player Who Killed?

Asked by 6 years ago
Edited 6 years ago

I know you have to do something like check if the damage thing kills the player but I don't get it can someone please give me example script that will help thank you

so on the part where it says

hum:TakeDamage(Damage)

i put

if hum.Health - Damage <= 0 then

hum:TakeDamage(Damage)

game.Players.LocalPlayer.leaderstats.Points.Value =

game.Players.LocalPlayer.leaderstats.Points.Value + 100

end

pls tell me for some reason it not work can you tell me how the right way is

0
create a creatortag and if the humanoid.Health == 0 then it finds the value of the creatortag (a player name) and awards that player awesomeipod 607 — 6y
0
swords use creatortags awesomeipod 607 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
game.Players.PlayerAdded:Connect(function(char)
    stats = Instance.new("IntValue")
    stats.Name = "leaderstats"
    stats.Parent = char
    d = Instance.new("IntValue")
    d.Name = "Deaths"
    d.Parent = stats
    d.Value = 0
end)
while wait() do
    for _,p in pairs(game.Players:GetPlayers()) do
        if p.Character.Humanoid.Health == 0 then
            local ls = p:FindFirstChild("leaderstats")
            local dth = ls:FindFirstChild("Deaths")
            dth.Value = dth.Value + 1
        end
    end
end
0
This script detects only if a Player dies and does not kill. DeceptiveCaster 3761 — 6y
0
no what i mean is if a person kills someone give him money i dont want a leaderboard i already have one AdventurousHeight 5 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

OMG GUYS I FIXED IT ALL I NEEDED TO DO WAS MAKE IT TO A LOCAL SCRIPT thanks

i think i had same problem always with me lol

0
lol DeceptiveCaster 3761 — 6y

Answer this question