Trouble making a NPC drop Part

Hello i’m currently trying to make, a npc drop a part “Gold Chest” and don’t know how i should do this :sweat_smile:
The Chest Already Has the feature to give gold. to the player’s leaderstat. just need it to spawn under the npc on death?.

image

  1. Respawn Npc Script
local new = script.Parent:Clone()
script.Parent.Humanoid.Died:connect(function()
	wait(1)
	new:MakeJoints()
	new.Parent = workspace
	script.Parent:Destroy()
end)
  1. Script that makes the npc “fade”
local head = script.Parent.Head.Decal
script.Parent.Humanoid.Died:Connect(function()
	for i = 0, 1, 0.01 do
		for _, part in ipairs(script.Parent:GetDescendants()) do
			if (part:IsA("BasePart")) then
				part.Anchored = true
				
				part.Transparency = part.Transparency + i
				head.Transparency = 1
			end
		end
		game:GetService("RunService").Heartbeat:Wait()
	end
end)

image

I’m just learning Lua go easy on me :smiley:

If you want it do just drop a part on death just do

local Chest = Instance.new("Part")
Chest.Parent = game.Workspace
Chest.Position = HumanoidRootPart.Position
1 Like

now that makes more sense idk how my brain didnt think of this thank you