Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make an npc drop an item?

Asked by 5 years ago

Hello. How do i make an npc like a zombie (R16) to have a chance or to be 100% sure that you will get an specific drop?

0
code it and then it will magically drop greatneil80 2647 — 5y
0
I dont know how to do it. Princess_Fexi007 0 — 5y
0
You can link a function to the Died() event of your NPC's humanoid. Then within that function you can spawn in the item you wish to drop. https://developer.roblox.com/api-reference/class/Humanoid SnowFunsize 55 — 5y

1 answer

Log in to vote
0
Answered by
Shematics 117
5 years ago

A effective way to do it is by creating a folder with every items you wish to drop, or some folder with specific item in it.

After you need to make a script that when his Humanoid Parents is killed, he does a function to clone and move it to the last known NPC position.

local copy = game:GetService('Folder').Dummy.NPC:Clone(); 
copy.Parent = workspace
copy:MoveTo(workspace.SpawnPoint.Position)

You can try yo use this type of code up here to move the NPC or a cloned one if you ever wish to make it respawn. Or even do the same with the object but with a function before local, which can be whatever ways you want like: "while true do" and assign a true or false value on the NPC Humanoid life, like if his "Health" reach "0" than it is true.

Don't know if this will help but hope it will.

0
Can you send me the script? Princess_Fexi007 0 — 5y
Ad

Answer this question