How to make items spawn it bag?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BagSystem = require(ReplicatedStorage.BagSystem)
local Zombie = script.Parent
Zombie.Humanoid.Died:Connect(function()
	BagSystem:drop(Zombie.PrimaryPart.Position, {})
end)

Put this inside of your zombie.

00:24:24.844 - Humanoid is not a valid member of Humanoid “Workspace.Drooling Zombie.Humanoid”

Could you show me where did you put the script?

Humaniod, but beforehand i placed it just into the general zombie

You should put it in the Zombie.

image

It didnt spawn and no error?
local zombie = script.Parent

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

local BagSystem = require(ReplicatedStorage.BagSystem)

local Zombie = script.Parent

Zombie.Humanoid.Died:Connect(function()

BagSystem:drop(Zombie.PrimaryPart.Position, {})

end)

for _, script in pairs(zombie.ModuleScripts:GetChildren()) do

if not game.ServerStorage:FindFirstChild(script.Name) then

script:Clone().Parent = game.ServerStorage

end

end

local AI = require(game.ServerStorage.ROBLOX_ZombieAI).new(zombie)

local DestroyService = require(game.ServerStorage.ROBLOX_DestroyService)

local function clearParts(parent)

for _, part in pairs(parent:GetChildren()) do

clearParts(part)

end

local delay

if parent:IsA(“Part”) then

delay = math.random(5,10)

else

delay = 11

end

DestroyService:AddItem(parent, delay)

end

zombie.Humanoid.Died:connect(function()

AI.Stop()

math.randomseed(tick())

clearParts(zombie)

script.Disabled = true

end)

local lastMoan = os.time()

math.randomseed(os.time())

while true do

local animationTrack = zombie.Humanoid:LoadAnimation(zombie.Animations.Arms)

animationTrack:Play()

– local now = os.time()

– if now - lastMoan > 5 then

– if math.random() > .3 then

– zombie.Moan:Play()

---- print(“playing moan”)

– lastMoan = now

– end

– end

wait(2)

end

1 Like

What did not spawn? Could you tell me

1 Like

The bag. the original script you helped me with

1 Like

Weird, because for me it works. Are you sure that there are no errors?

https://i.gyazo.com/0b334a18cd8c38995014eb9b39bc30c3.mp4

yeah no errors come up and no bag

Could you send me the place so I can see?

1 Like

would a team create be better?

1 Like

Nah, just send me the place. So I can take a look at it.

1 Like

Zombie bag.rbxl (79.1 KB)

1 Like

I made couple fixes. I had put the code in separate Script and I had set the PrimaryPart.
Zombie bag.rbxl (79.1 KB)

1 Like

Thanks alot :smiley:
ill be sure to let you know with anything i need more assitance on

1 Like

Alright, could you mark my post as solution? so people don’t come here to try to answer. The first one I made. Anyways have a good day :happy1:.

1 Like