How to make a part move in the direction it is facing?

How can I make my blocks move in the direction it is facing rather than moving upwards?

for i,g in pairs(script.Parent:GetChildren()) do
		if g:IsA("Part") then
			g.Size = Vector3.new(g.Size.X,script.Music.PlaybackLoudness*0.006,g.Size.Z)
			wait()			
		end	
	end

The z axis is generally the facing direction. It’s moving upwards because your changing the y axis.

Assuming you know the face of the part which you want to resize (which by “direction it’s facing”, I assume you mean the front and only the front), you can use part:Resize() with Enum.NormalId.Front. Here are the docs:

https://developer.roblox.com/en-us/api-reference/function/BasePart/Resize