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

Why isn't this working? Doesn't give points when killing another player?

Asked by 8 years ago
Edited 8 years ago

The idea of this script is to give me currency and experience points when I kill another player. However it isn't working.

local cv = c.Humanoid:findFirstChild("creator")
game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(c)
        c.Humanoid.Died:connect (function()
            if cv then local k = cv.Value if k and k ~= p then
                k.leaderstats.Experience.Value = k.leaderstats.Experience.Value + 100
                k.leaderstats.Currency.Value = k.leaderstats.Currency.Value + 50
        end)
    end)
end)

3
This script is really messed up. User#11440 120 — 8y
0
Agreed, try organizing your script - don't use functions in functions. Florian27 76 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

When you do local cv = c.Humanoid:findFirstChild("creator") the variable c doesn't exist at the time, meaning the script isn't able to find the localc. You would need to replace all the cv's with c.Humanoid:findFirstChild("creator") and then try it. However it still might not work as the script is quite messy.

Ad

Answer this question