Model not destroying after touched with tool

Hello devs,

So I’ve been trying to make it so when the axe touches the door model, the door model gets destroyed as in disappear. I’ve got a similar system in my game of when you touch a part with a specific tool it destroys the part, but since in this situation it’s a model and not a part, it’s a bit different to get it to work. Since I know so little of scripting, I tried using the API Reference for some help and couldn’t really find something that would work. I also tried “:Destroy()” since it’s worked for me in the past but for some reason it didn’t work this time.

Video of what things currently look like:

How things are set up right now:


Code inside the script:


I thought of what could be the most logical way to go about destroying the door model after touched with the axe which was “script.Parent:Destroy()” at the end. Unfortunately though, it didn’t work.

The setup and code for the axe (it works perfectly fine itself but including it just incase):


I’d appreciate help from anyone as this is getting a bit frustrating and DevForums is my last hope for figuring this problem out as I have an ok understanding on scripting.

You should do the opposite and do, if the axe is touched by a model and its name is “MazeDoors” it should :Destroy() it

Since it will only work on the parts you could do hit.Parent.Parent(that will be the whole model if im correct)

For the axe, that script has worked for me but things are kind of all over the place since this is a model and not a part like how I’m use to.

So would it be something like this?

If so, I tried it and it didn’t really do anything to the door.

1 Like

You are destroying the axe not door

Well it didn’t destroy the axe either, nothing really happened.

It should be something like this

function ontouch(hit)
 if hit.Parent.Parent.Name == "MazeDoors" then

script.Parent.Touched:Connect(ontouch) -- this script is inside the axe

I’m confused on how that’ll fit in the script as the axe is also scripted so it can be picked up with a tool giver system type thing. It kinda messed up how the axe functions when I tried implementing your script.

You can activate the function when the axe is activated

Issue is where you’re looking for the AxeGear. Your door’s detection script is looking for an AxeGear child in the part that touches it. Thing is that what touches the door could be the handle of the gear or the player’s arm and neither of those has AxeGear as a child. Second issue is that models do not have Touched signals so you can’t connect to them. Check your console for errors when things don’t work.

You can use a single part that encompasses the bounding box of your doors and is made invisible to serve as a detector for the tool. From there, you can check when parts touch it and see if, for example, the parent is your axe tool and is accordingly named.

The following code assumes you employ my advice and put this script in your detector.

local function onTouch(hit)
    if hit.Name == "Handle" and hit.Parent.Name == "AxeGear" then


I fixed it nvm, the script ended up looking like this at the end:

local function onTouch(hit)
if hit.Name == “Handle” and hit.Parent.Name == “Axe” then


1 Like