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’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.
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