Attempt to index nil with 'BillboardGui'

Hello Roblox,

Always when i run my code:

for _, object in ipairs(workspace:GetDescendants()) do
	if object:IsA("ProximityPrompt") then
		
		if object.Parent:FindFirstChild("Humanoid") then
			if object.KeyboardKeyCode == Enum.KeyCode.Q then
				object.Triggered:Connect(function(Player)
					loadanim:Play()
					object.Parent.Humanoid.Health = 0
					
					object.Parent.ClickDetector:Destroy()
					object.Parent.PromptScript:Destroy()
					object.Parent.ProximityPrompt:Destroy()
					object.Parent.BillboardGui:Destroy()
					
			end)
			end
		end
	end
end

I get this error: Players.Mainixy.PlayerScripts.LocalScript:13: attempt to index nil with ‘BillboardGui’
Please help me.

~Maini

object.Parent.ProximityPrompt:Destroy() destroys object therefore parenting it to nil. Instead the character should be stored inside a variable:

local character = object.Parent

character.Humanoid.Health = 0			
character.ClickDetector:Destroy()
character.PromptScript:Destroy()
character.ProximityPrompt:Destroy()
character.BillboardGui:Destroy()

or the line object.Parent.ProximityPrompt:Destroy() should run after destroying everything else.