#how can i make the copied parts in the script not overlap when spawned in

30 messages · Page 1 of 1 (latest)

covert fiber
#

local mytablewithparts = game.Workspace.Buildings:GetChildren()

local tablewithclonedparts = {}

for i, v in pairs(mytablewithparts) do
local clonethevalue = v:Clone()
clonethevalue.Parent = game.Workspace.Clonedparts
clonethevalue.Name = "clonedbuilding"
clonethevalue.Anchored = true
clonethevalue.Position = Vector3.new(math.random(1,100), 1 , math.random(1,100))
table.insert(tablewithclonedparts, clonethevalue)
end

for i, v in pairs(tablewithclonedparts) do
wait(1)
v.Color = Color3.new(math.random(1,255), math.random(1,255), math.random(1,255))
end

next sparrow
#

hmm

#

Im not really sure how you can pull this off

#

If anything you should just make it so if the two blocks touch they just automaticaly destroy

#

It might slow the spawning

#

But its the only way

#

Atleast the only one someone like you could think of.

#

You should actually use a diff script

covert fiber
#

you think its too hard for me to pull off?

azure wave
#

It’s not that hard

#

U just need a little math

#

I’m a lil slow try to figure it out 🙃

#

Use the position and the size to get the boundaries

#

Then check the magnitude with the boundaries of the one about to be spawned

#

And redo if it is intersecting

#

You can also use GetPartsInPart but that’s slower

covert fiber
#

im not a big math guy

#

isnt magnitude length or sum

azure wave
#

Yeah

#

You check the length to see if it’s too short

#

I’ll think of something tmr

dapper coral
#

use cancollide 🤑

#

@covert fiber

covert fiber
#

idk how

#

i can search up ltr

#

ty

covert fiber
#

i need them anchored

#

they can collide in the pic i sent

#

but they are anchored