i want to know how to alter the z scale of an object but transform.scale doesn’t work
You’re looking for transform.localScale
transform.localScale. You know, Unity does have documentation; all you have to do is look up Transform and you can find that easily enough.
check this out it is what you need.