I Need To Find A Part That Touched A Destroy Part i.e.: Tycoon Sell Block
I Want A Solution For A Ball Touching A Part Then Being Destroyed
Example:
III
III
O <== Destroyed When Touching
_ <==
First Post So Its Bad
I Need To Find A Part That Touched A Destroy Part i.e.: Tycoon Sell Block
I Want A Solution For A Ball Touching A Part Then Being Destroyed
Example:
III
III
O <== Destroyed When Touching
_ <==
First Post So Its Bad
the touched function returns the part that touched it, just use that and done.
part.Touched:Connect(function(partThatTouchedLolBeans)
end)
--specify the part
Part = script.Parent
--makes a function that fires when touching something, otherpart is the part it touches
Part.Touched:Connect(function(otherpart)
-- checks if the other part it touches is a part destroyer
if otherpart.Name == ("PartDestroyer") then
--destroy part
Part:Destroy()
end
end)
Not tested yet let me know if it works
Also name the part you want to be the destroy part “PartDestroyer” or it won’t work
Does It Matter If “Otherpart” Needs To Be Specified In Order For It To Work
The Part Is An Instance.New Part So I Doubt It Can Be Specified
No it doesn’t lemme edit the script and add comments so u can add it to ur game easier
Edit: Finished check it out now
Try something like this:
local name = "Special"
script.Parent.Touched:Connect(function(hit)
if hit:IsA("Part") and hit.Name == name then
hit:Destroy()
end
end)
Change the name variable to the name of the part you want to be destroyed. I tested it, and it should work.