So I need a part to destroy when it touches any part in the model "Scenery" but I don't know what I'm doing. Here's all I got:
local scenery = game.Workspace.Scenery:GetDescendants() for index, descendant in pairs(scenery) do script.Parent.Touched:connect(function(descendant) script.Parent:Destroy() end) end
this script goes inside the part that is supposed to get destroyed when it touches scenery
This is actually fairly simple, just use one Touched event but in that function, check to see if the part touched is a descendant of the model.
local model = model -- Just an example script.Parent.Touched:connect(function(part) if part.Parent == model then -- Continue end end)
I think you should make a function that destroys the part when it touches any of scenery's children. I would also put the script into serverscript storage and just name the part that is supposed to be destroyed... so maybe something like this (assuming all of scenery's children are parts and not models)
local scenery = game.Workspace.Scenery:GetChildren() function destroyPart() game.Workspace.*PartName*:Destroy end scenery.Touched:connect(destroyPart)
I hope this helps now that I look at it I think it kind of looks like yours except without descendants. Also, this won't work if anything besides the part touches scenery since it will destroy the part.