So im using this to resize the brick
repeat wait(0.05) i = i+1 expl.Position = script.Parent.Position + Vector3.new(0,-6,0) expl.Size = Vector3.new(i*2,i*2,i*2) expl.BrickColor = BrickColor.Random() until i == 100
and everytime it collides with an object when resizing it teleports up.
Surprisingly enough, I had this same issue a couple days ago. I tried everything. I figured it out with one bit of code. Here's your code fixed:
for i=1,100,1 do wait(0.05) -- Waits 0.05 seconds expl.CanCollide = false -- Makes it so the part can't collide expl.Size = Vector3.new(i*2,i*2,i*2) -- Changes the size of "expl" expl.CFrame = script.Parent.CFrame + Vector3.new(0,-6,0) -- Sets the CFrame which is more efficient then the Position. This is so that right after the size is changed, the position is set to it's proper position expl.BrickColor = BrickColor.Random() -- Sets the brick color expl.CanCollide = true -- Makes it so the part can collide end
I made small adjustments. First up I changed the repeat loop to a for loop. You were essentially using a more complicated for loop. A for loop takes 3 arguments. The first is the starting number. The second is the final number. The third is the increment by which it increases. I added two CanCollide lines to make sure that when the brick is growing bigger if it hits something it doesn't move upwards, or to any other location. First, it waits 0.05 seconds. Next, it makes the brick uncollidable. Then it changes the size. Now comes the position. I replaced Position with CFrame as it's more predictable and works more efficiently. Now the brickcolor is set to a random brickcolor. Finally, it's set collidable again. This should work fine. Let me know if you have any issues.
on line 5 put
expl.CanCollide = false
on line 7 put
expl.CanCollide = true until i == 100