I tried putting this script in the monster local Humanoid = script.Parent.Human function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local theinventory = tag.Value:findFirstChild("PlayerGui").Inventory2 local theinventoryparts = theinventory:GetChildren() for i, v in pairs(theinventoryparts) do wait(0.5) if v.SlotValue.Value == "" then v.SlotValue.Value = "Wood" --Change this to desired variable so you can have any weapon v.Ammt.Value = 5 v.SlotLabel.Text = v.Ammt.Value v.SlotImage.Image = "http://www.roblox.com/asset/?id=539465370" break elseif v.SlotValue.Value == "Wood" then v.Ammt.Value = v.Ammt.Value + 5 v.SlotLabel.Text = v.Ammt.Value break --This script we just wrote will make it so you can stack wood end end wait(0.1) script:remove() end end end Humanoid.Died:connect(PwntX_X) but it doesn't seem to work
COMMUNITY QUESTION
So I'm trying making an on monster kill put on inventory script?
1 answer
local Humanoid = script.Parent.Human
function PwntX_X()
local tag = Humanoid:findFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local theinventory = tag.Value:findFirstChild("PlayerGui").Inventory2
local theinventoryparts = theinventory:GetChildren()
for i, v in pairs(theinventoryparts) do
wait(0.5)
if v.SlotValue.Value == "" then
v.SlotValue.Value = "Wood" --Change this to desired variable so you can have any weapon
v.Ammt.Value = 5
v.SlotLabel.Text = v.Ammt.Value
v.SlotImage.Image = "http://www.roblox.com/asset/?id=539465370"
break
elseif
v.SlotValue.Value == "Wood" then
v.Ammt.Value = v.Ammt.Value + 5
v.SlotLabel.Text = v.Ammt.Value
break --This script we just wrote will make it so you can stack wood
end
end
wait(0.1)
script:remove()
end
end
end
Humanoid.Died:connect(PwntX_X)
You should also give the output so that it is easier to help you.
One thing I speculate is that it doesn't work because there is no child in the character (or it may not actually be a character) named "Human".
Also, I think maybe it does not work because the tag doesn't exist when you kill the monster.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Put the script into a code block please