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

Why would this script not work?

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").

3 comments

0

Did you get anything from the output, or did it just stop all together?

0

So I think the problem is that tag = nil. So we need to get tag~= nil.

0

The problem is most likely the weapon not tagging the humanoid correctly.

1 answer

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

7 comments

0

Ok, but it still doesn't work... ,_,

0

Updated please give me rep :D

0

Zombie is the name of the Humanoid.

0

Than is the gun you're using support this?

0

I'm using a sword...

0

Doesn't really change the question cause what your asking is why isn't this firing and not giving us enough info sorry

0

If you want I can give you the whole model with the leaderboard and everything and you can fix it:D

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