I have a script that scales down a random part in a folder. I want to scale it down from the top, but it scales it down on the top and bottom. This is how it looks:
Here’s the script:
local C = script.Parent.Folder:GetChildren()
while true do
for i = 1,#C do
local Y = math.random(2, 4)
if C[i].Name == "Tile" then
while true do
local Tile = C[math.random(1, #C)]
Tile.Size = Vector3.new(9.5, Tile.Size.Y - Y, 9.5)
Y = math.random(2, 4)
wait(.001)
end
end
end
wait()
end
local function CustomResize(Part,NormalID,Delta)
local Normal = Vector3.FromNormalId(NormalID)
local Invert = Normal.X+Normal.Y+Normal.Z
local NewSize = Part.Size + (Normal * Delta * Invert)
if ((NewSize.X < 0.05) or (NewSize.Y < 0.05) or (NewSize.Z < 0.05)) then return end
Part.Size = NewSize
Part.CFrame *= CFrame.new(Normal * Delta * 0.5)
return true
end
local C = script.Parent.Folder:GetChildren()
while true do
for i = 1,#C do
local Y = math.random(2, 4)
if C[i].Name == "Tile" then
while true do
local Tile = C[math.random(1, #C)]
local function CustomResize(Tile,NormalID,Delta)
local Normal = Vector3.FromNormalId(NormalID)
local Invert = Normal.X+Normal.Y+Normal.Z
local NewSize = Tile.Size + (Normal * Delta * Invert)
if ((NewSize.X < 0.05) or (NewSize.Y < 0.05) or (NewSize.Z < 0.05)) then return end
Tile.Size = NewSize
Tile.CFrame *= CFrame.new(Normal * Delta * 0.5)
return true
end
CustomResize(Tile, Enum.NormalId.Bottom, 2)
end
end
end
wait()
end