You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I Want To Make The NPC Drop 5 Coins When It Dies.
What is the issue? Include screenshots / videos if possible!
The Script Is Inside The Dummy’s Humanoid And The Coin Is In Lightning Because It was instructed in the video to put it in lightning
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve Tried Watching Youtube But The Script Did Not Work.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
function onDied()
wait(1)
local Drop = game.Lighting("Coin"):Clone()
Drop.Parent = game.Workspace
script.Parent.Parent:Destroy()
end
script.Parent.Died:Connect(onDied)
^ That is the script that was used on the video I watched and it doesn’t work for me
local function onDied()
wait(1)
local Drop = game:GetService("Lighting"):WaitForChild("Coin"):Clone()
Drop.Parent = game:GetService("Workspace")
--I believe you want to destroy character here:
for i, v in pairs(Character:GetChildren()) do --Replace Character with your character (it is probably script.Parent.Parent).
if v:IsA("Part") or v:IsA("MeshPart") then
v:Destroy()
end
end
end
Humanoid.Died:Connect(onDied) --Replace Humanoid with your Humanoid.