How to make a part unanchor, on touch from another part

I was wondering how I would do this, I didn’t even know how I can program it to practice. Games such as natural disaster survival have it, so I was just wondering

Pretty much a block touches a block, the block that it touches gets unanchored on touch.

You would have to use the touched event and make sure that the block that touched the block is the block you wanted it to touch. For example,

local TouchPart1 = workspace.TouchBlock1 -- or whatever the touch block is
local TouchPart2 = workspace.TouchBlock2 -- whatever the second block is

TouchPart1.Touched:Connect(function(Object)
    if Object == TouchPart2 then
        TouchPart1.Anchored = false
    end
end)

Ok thanks, but how would I do that for any block, without replicating it to one block?

take off the if statement and just do

Block.Touched:Connect(function()
    Block.Anchored = false
end)
2 Likes

What would I do if I wanted the part to unanchor any part that it touched?