23:21:13.612 - Workspace.Model.Tool.Part.Script:23: attempt to index nil with 'Destroy'
The parts of the Dummy Model are suppose to slowly turn transparent when health reaches 0. But it does not work. The error prints nil to Destroy, but the script for the parts disappearing works.
Part = script.Parent
local Dummy = game.Workspace.Dummy
local Players = game.Players.LocalPlayer
local Debounce = false
local Model = game.Workspace.Dummy
local Killable = game.Workspace:GetChildren()
Part.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if Dummy and Humanoid and Debounce == false then
Debounce = true
Humanoid.Health = Humanoid.Health - 25
wait(0.1)
Debounce = false
if Humanoid.Health == 0 then
for tranparency = 0, 1, 0.1 do
Model:GetChildren().Transparency = 1
end
wait(5)
Humanoid.Parent:Destroy()
end
end
end)
