so i make a kind of rpg games. I got the error when the dummy is being replicated to workspace
local rs = game:GetService("ReplicatedStorage")
while wait(0.1) do
if script.Parent:FindFirstChild("Humanoid") then
if script.Parent.Humanoid.Health < 1 then
local owner = script.Parent.Owner
local plr = game.Players[owner.Value]
if plr.Quest.Value == true and plr.Tipe.Value == 1 then
plr.Required.Value = plr.Required.Value + 1
end
plr.leaderstats.Power.Value = plr.leaderstats.Power.Value + 1000
wait(5)
local kelon = rs.D1:Clone()
kelon.Parent = workspace
if kelon then
kelon.PointGiver.Disabled = false
script.Parent:Destroy()
end
end
else
return
end
end
19:19:44.511 - Workspace.D1.PointGiver:4: attempt to index nil with 'FindFirstChild'
19:19:44.513 - Stack Begin
19:19:44.515 - Script 'Workspace.D1.PointGiver', Line 4
the script is working well but i keep getting that error. i wll appreciate every help

4 comments
Where's the script? I mean in what?
inside npc model
It looks like the error is because of line 17, where you call
script.Parent:Destroy(). This will break the script. It's not recommended to destroy a script or anything in its ancestry, because the script will not finish running.so i just need to refill the health to make the dummy respawn?