I made a simple script where if the NPC dies, then you'll get the weapon would be said within the script. It doesn't seem to work though. Anyone have ideas of why it isn't working? (FilteringEnabled)

local Humanoid = script.Parent.MobHumanoid
local dropchance = 1000

function PwntX_X() 
	local tag = Humanoid:findFirstChild("creator") 
	if tag ~= nil then
		if tag.Value ~= nil then
			local droprange = math.random(1, 1000)
			if dropchance >= droprange then
				local bp = tag.Value:findFirstChild("Backpack") 
				local sp = tag.Value:findFirstChild("StarterGear")
				local wep = game.ReplicatedStorage.Weapons.FalchionC:Clone()
				wep.Parent = bp
				local wep2 = wep:Clone()
				wep2.Parent = sp
				wait(0.1)
				script:remove()
			end 
		end 
	end 
end

Humanoid.Died:connect(PwntX_X) 

3 comments

0

on line 9 change >= to <=

0

Still not working Ruben

0

can you add print statements all over it to see how far it's getting? It's not very easy to troubleshoot it without knowing the error itself (other than what Ruben said)