You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want it so that when a certain part touches another part, it destroys that part.
What is the issue? Include screenshots / videos if possible!
I have a script, but whenever I test, it never destroys.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I put print statements but none printed.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
script.Parent.Touched:Connect(function(hit)
print("hit")
if hit.Parent:FindFirstChild("Part") then
print("Is part")
if hit.Parent.Name == "Fall" then
print("Is fall part")
hit.Parent:Destroy()
print("Destroyed")
end
end
end)
This script looks fine by itself, assuming you placed it in a normal Script inside the part you want to be touched, and not a LocalScript or something. The problem is probably with the hierarchy of hit. What does the hierarchy of Fall look like?
I think you could do something like this. You cant print “hit” because it hasnt been defined yet
script.Parent.Touched:Connect(function(hit)
if hit.Parent:WaitForChild("NameOfThePart") then
print("I hit it:)
if hit.Parent.Name == "NameofthePart" then
print("IDonet")
hit.Parent:Destroy()
print("Destroyed")
end
end
end)
That should work.