How to make NPC that drops part - a whole chest! After being killed

I’d like to make NPC that’ll drop a chest after being defeated. Chest would be anchored to the place where it falls and normally function as part, with proximity prompt etc, how can i achieve something like this?

Make the chest and put it somewhere in the workspace.
Add the proximity prompt to it, and customize it however you wish. Hide the chest, either by putting it in a room away from the map or by setting all of the parts in its transparency to 1 and CanCollide to false, as well as disabling the ProximityPrompt. This is so that the model exists and is ready to be cloned into the NPC.

Make a script that works somewhat like this:

local Chest = workspace.Chest -- Change this to the location of the chest
local NPC = script.Parent -- Make sure the script is a child of the NPC!!

while NPC.Humanoid.Health ~= 0 do
local new_chest = Chest:Clone()
  new_chest:PivotTo() -- Put the Vector3 position of the NPC inside of the parentheses
  for i, p in new_chest do
    if p.Name == "ProximityPrompt" then
      p.Enabled = true
      p.Transparency = 0
      p.CanCollide = true

This isn’t the complete process but I’m sure you can take it from here. If you have any questions, feel free to ask!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.