You need one position per node in your array. Use entry times: arr[tin[v]] = value[v]. Subtree of spans positions tin[v] to tout[v] in this array.
But tout[v] does not hold a node value. The range is [tin[v], tout[v]] but only positions with nodes (entry times) contribute to the sum. Since entry times are consecutive (), the range query works correctly. Make sure your tout[v] boundary is inclusive or exclusive consistently throughout your code.