Hello i’m currently trying to make, a npc drop a part “Gold Chest” and don’t know how i should do this
The Chest Already Has the feature to give gold. to the player’s leaderstat. just need it to spawn under the npc on death?.
- 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)
- 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)
I’m just learning Lua go easy on me