Everything here works more or less how I want it to, except one thing. I can't figure out how to destroy all instances of W. The script's goal was to create a large ball that grabbed everything it touched and pulled it into it's center as soon as you stepped on a block. The problem is, after this vacuum dissipates, it leaves you stuck at it's used-to-be core. I just want all BodyPositions to be removed after the script finishes, yet I can't seem to figure out how.(I have low knowledge on scripting still and have been working on this single thing for 3 hours)
Debounce = false
block = script.Parent.Position
function touch(hit)
if Debounce == false then
Debounce = true
wait(5)
local bh = Instance.new("Part", workspace)
bh.Name = "bh"
local function touched(bop)
if bop.Anchored == false then
local w = Instance.new("BodyPosition", bop)
w.Name = "w"
if bop:findFirstChild("w") then
for i = 100, 1000, 10 do
w.D = i
w.P = i
w.Position = block
w.MaxForce = Vector3.new(i,i,i)
wait(.05)
end
end
end
end
workspace:findFirstChild("bh").Touched:connect(touched)
if workspace:findFirstChild("bh") then
bh.Shape = 0
bh.BrickColor = BrickColor.new(1003)
bh.CFrame = CFrame.new(block)
bh.Anchored = true
bh.CanCollide = false
for i = 1, 50, 1 do
bh.Size = Vector3.new(i,i,i)
bh.CFrame = CFrame.new(block)
wait(i/2000)
end
for i = 50, 1, -.5 do
bh.Size = Vector3.new(i,i,i)
bh.CFrame = CFrame.new(block)
wait(i/6000)
end
bh:Destroy()
Debounce = false
end
end
end
script.Parent.Touched:connect(touch)

3 comments
Thank you for the help! I chose yours because you answer just happened to be simplest with my current knowledge. Plus detail.
There's a better way to do this, and what you provided doesn't really help. He's trying to find body mover created by the blackhole. The body movers aren't parented to workspace, which means he would have to use it in a for loop which checks all of the objects effected by the blackhole.
I'm not really sure what you're talking about. This is the simplest way that you could possibly do this. And they are DESCENDANTS of Workspace, so this code works perfectly fine. Did you even read how I explained it?