Help with sizing a part

I made a script that has the starting value 35 and will subtract 0.05 every stage, Except I only want it to be sized in one direction because it messes everything up and allows the player to touch it without actually doing anything if i am able to size it in one direction, it will only be the start of every stage to prevent overlapping.


wait(10)
local part1 = game.Workspace["Lava Wall Jump"]:FindFirstChild("kp" .. tostring(tonumber(script.Parent.Name))) 
local part2 = game.Workspace["Lava Wall Jump"]:FindFirstChild("kp" .. tostring(tonumber(script.Parent.Name + 1)))

if part1 and part2 then
 
	local distance = 35-(0.07*tonumber(script.Parent.Name))

	script.Parent.Size = Vector3.new(15.255,0.1,distance)
else
	print("One or both of the parts do not exist.")
end
1 Like

My solution is to subtract the size instead of manually setting it. To prevent it from sizing in two directions, you would need to offset it’s position.

local distance = 0.05
part.Size -= Vector3.new(0,0,distance)
part.Position -= Vector3.new(0,0,distance/2)

I hope my solution helped!

3 Likes