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

Why would this script not work?

Asked by 9 years ago

The leaderstats are working, it is this part of the script that is not:

local Humanoid = script.Parent.Zombie -- Or Zombie Or Whatever 
function PwntX_X() 
    print("1")
local tag = Humanoid:findFirstChild("creator")
print("2") 
if tag ~= nil then 
        print("3")
        if tag.Value ~= nil then 
            print("4")

local Leaderstats = tag.Value:findFirstChild("leaderstats") 
print("5")
            if Leaderstats ~= nil then 
                print("6")
Leaderstats.Cash.Value = Leaderstats.Cash.Value + 5
print("7")
wait(0.1)
script:remove()
            end 
        end 
    end 
end 
Humanoid.Died:connect(PwntX_X) 

It breaks between print("2") and print("3").

0
Did you get anything from the output, or did it just stop all together? Mazux 140 — 9y
0
So I think the problem is that tag = nil. So we need to get tag~= nil. MasterXertz 0 — 9y
0
The problem is most likely the weapon not tagging the humanoid correctly. NotsoPenguin 705 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Sorry if this comes off a bit like a smart ass but it has to be said. It's not findFirstChild because findFirstChild IS DEPRECATED use FindFirstChild instead. NEVER USE DEPRECATED FUNCTIONS

Anways to answer your question you did script.Parent.Zombie if zombie is the name of a Humanoid object this should stay however if it isn't it should be script.Parent.Zombie.Humanoid

0
Ok, but it still doesn't work... ,_, MasterXertz 0 — 9y
0
Updated please give me rep :D nstrike159 15 — 9y
0
Zombie is the name of the Humanoid. MasterXertz 0 — 9y
0
Than is the gun you're using support this? nstrike159 15 — 9y
View all comments (3 more)
0
I'm using a sword... MasterXertz 0 — 9y
0
Doesn't really change the question cause what your asking is why isn't this firing and not giving us enough info sorry nstrike159 15 — 9y
0
If you want I can give you the whole model with the leaderboard and everything and you can fix it:D MasterXertz 0 — 9y
Ad

Answer this question