I'm creating a humanoid that when it gets killed, it drops a dollar bill from the sky... The only thing is, I want the dollar to kill the humanoid when it collects it. This is what I have so far.
function onDied()
for i =1,script.GoldCount.Value do
local xp = Instance.new("Part")
xp.Parent = game.Workspace
xp.Position = script.Parent.Parent.Torso.Position + Vector3.new(math.random(-3,3),math.random(-3,3),math.random(-3,3))
xp.Shape = 1
xp.formFactor = "Symmetric"
xp.Name = "XP"
xp.BrickColor = BrickColor.new(1021)
xp.Reflectance = 0.2
xp.Size = Vector3.new(1.5,.5,3)
xp.TopSurface = 2
local clone = script.Increase:Clone()
clone.Disabled = false
clone.Parent = xp
end
end
script.Parent.Died:connect(onDied)
Then I have a lava script that I was trying to put in the other, but didn't know how.
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h ~= nil then
h.Health = 0
end
end
script.Parent.Touched:connect(onTouched)
Anyone know how this could be fixed? Thanks!

1 comment
Only problem I see is that findFirstChild is wrong, it should be FindFirstChild.