I was the part to extend like this:
[0-----]
But the part keeps extending like this:
[---0---]
Script:
local Part = script.Parent local Debounce = false Part.Touched:Connect(function(hit) if not Debounce then Debounce = true local Humanoid = hit.Parent:WaitForChild("Humanoid") if Humanoid then for i=0, 5 do Part.Size = Part.Size + Vector3.FromAxis(Enum.Axis.X) wait() end end end end)
you will need to reduce the Position to the half of the size you increased
local Size = 5 local Part = workspace.Part Part.Size += Vector3.new(0,Size,0) Part.Position -= Vector3.new(0,Size/2,0) --i dont think you can do both at once
or
local function changeSideSize(side, studs, part) if side == "top" then part.Size += Vector3.new(0, studs, 0) part.Position += Vector3.new(0, studs/2, 0) end if side == "bottom" then part.Size += Vector3.new(0, studs, 0) part.Position -= Vector3.new(0, studs/2, 0) end if side == "left" then part.Size += Vector3.new(studs, 0, 0) part.Position -= Vector3.new(studs/2, 0, 0) end if side == "right" then part.Size += Vector3.new(0, studs, 0) part.Position += Vector3.new(studs/2, 0, 0) end if side == "front" then part.Size += Vector3.new(0, 0, studs) part.Position += Vector3.new(0, 0, studs/2) end if side == "back" then part.Size += Vector3.new(0, 0, studs) part.Position += Vector3.new(0, 0, studs/2) end end