Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Parts won't constantly be in the same location, how to fix?

Asked by 2 years ago
Edited 2 years ago
local Ablock = game.workspace.A
local Bblock = game.workspace.B
while true do
    local parttouchB = Bblock:GetTouchingParts() -- returns a table of parts intersecting B
    for i,v in pairs(parttouchB) do
        if v == Ablock then
            Ablock.anchored = true
        else
            Ablock.anchored = false
    wait()
        end
    end
end

Hello, I have received this script, So basically

When Part B touches part A, part A must be anchored else A must be unanchored.

The script I have works 100% OK, the only problem is that Part A & B won't always be in the workspace. They could be in groups with different names (Won't constantly be in the same location.)

Is there a way I can fix this?

Thanks

0
btw it was my mistake, isnt it meant to be anchored instead of anchor sne_123456 439 — 2y
0
Thanks! Dinoboshoff1 -17 — 2y

Answer this question