Destroy object when overlapping

How to destroy the object when overlapping with the player?

Try this script. This script needs to have networking enabled and be a direct child of the trigger which must also have networking enabled. All children of the trigger must have networking enabled.

local Trigger = script.parent
--This function will be called whenever an object enters the trigger
function OnEnter(trigger, coreObj)
    --Check if a player entered the trigger, if so, destroy the trigger and intern, all of its children
    if(coreObj:IsA("Player")) then
--Bind the "OnEnter" function to the "beginOverlapEvent" of the trigger that is fired whenever an object enters the tirgger