Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Wont add anything to the leaderboard?

I'm trying to make this when zombie gets kills it adds 8 heads to the leaderboard but its not working!!! please help

local Humanoid = script.Parent.Zombie -- Or Zombie Or Whatever 
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
    if tag ~= nil then 
        if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") 
            if Leaderstats ~= nil then 
Leaderstats.Heads.Value = Leaderstats.Heads.Value + 8
wait(0.1)
script:remove()
            end 
        end 
    end 
end 
Humanoid.Died:connect(PwntX_X) 

5 comments

0

Why would it? A Zombie has a value inside of it that somehow has a leaderstats inside of it?

0

im confused i dont understand what ur saying

0

Your question is very confusing...Is this zombie a "Minion" to a certain player?

0

Does anyone notice that this is a Duplicate Question?

0

its a duplicate because the dude is giving me wrong answers on old one

1 answer

✓ Accepted answer
local Humanoid = script.Parent.Zombie -- Or Zombie Or Whatever 
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
    if tag ~= nil then 
        if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") --Im pretty sure your problem is here, it is looking for "leaderstats" inside of a value?
            if Leaderstats ~= nil then 
Leaderstats.Heads.Value = Leaderstats.Heads.Value + 8
wait(0.1)
script:remove()
            end 
        end 
    end 
end 
Humanoid.Died:connect(PwntX_X) 

Try this

local Humanoid = script.Parent.Zombie -- Or Zombie Or Whatever 
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
    if tag ~= nil then 
        if tag.Value ~= nil then 
local Leaderstats = game.Players:findFirstChild(tag).leaderstats 
            if Leaderstats ~= nil then 
Leaderstats.Heads.Value = Leaderstats.Heads.Value + 8
wait(0.1)
script:remove()
            end 
        end 
    end 
end 
Humanoid.Died:connect(PwntX_X) 

I might not be spot on with my answer, but gives this a shot

2 comments

0

not its not as a minion...have u played a game that when u kill a zombie it gives u points in the leaderboard this script wont do it i placed it into a zombie killed the zombie and it wont add to the leaderbord

0

I know that to do that, you need Killer and Victim events, but i dont know how to do that

This discussion is preserved as it was. New answers, comments, and votes are closed.