script.Parent.Touched:Connect(function()end) while true do wait(1) local part = script.Parent local bounds = part:GetTouchingParts() for _, p in next, bounds do if p == nil then print("nothing") end end end
this script gets the parts that are inside it using GetTouchingParts() I was trying to get it to output nil when there is nothing touching but it wont throw an error or say nil when there is nothing inside it. this is a problem because I need to be able to do something else when a specific part/model that "was" touching is now gone. is there a way to make this as easy as using FindFirstChild() to get a nil value?(findfirstchild didnt work when I combined it btw)
delete the end) after connect(function() and put a ) at the last line ur not connecting the function right now
here is what i mean u should do
script.Parent.Touched:Connect(function() while true do wait(1) local part = script.Parent local bounds = part:GetTouchingParts() for _, p in next, bounds do if p == nil then print("nothing") end end end)