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 3 years ago
Edited 3 years ago
01local Ablock = game.workspace.A
02local Bblock = game.workspace.B
03while true do
04    local parttouchB = Bblock:GetTouchingParts() -- returns a table of parts intersecting B
05    for i,v in pairs(parttouchB) do
06        if v == Ablock then
07            Ablock.anchored = true
08        else
09            Ablock.anchored = false
10    wait()
11        end
12    end
13end

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 — 3y
0
Thanks! Dinoboshoff1 -17 — 3y

Answer this question