Problem with :Resize() Function

I’m trying to make curtain that would smoothly open after player interacts with it, i’ve been trying to achieve that with :Resize() function and for loop, like in this sample script:

script.Parent.ClickDetector.MouseClick:Connect(function()
	for i = 1, 10 do
		script.Parent:Resize(1,1)
	end
end)

The problem is that my mesh is rather small and resize function does not work with numbers below 1, numbers from 0 to 0.5 does not do anything, and numbers from 0.5 (including) to 1, resize part by 1. Is there any way i can make this still using this resize function, or do i need to make it some other way? if so, then is there any easy method to make this?

Here is full script if someone needs it:

local parent = script.Parent
local model = parent.Parent

local isOpen = true
local deb = false


local function ChangingStatus()
	if deb == false then
		deb = true
		if isOpen == false then
			isOpen = true
			for i = 1, 25 do
					wait()
					script.Parent:Resize(1,(1.3)/25)
				end
			deb = false
		elseif isOpen == true then
			isOpen = false
				for i = 1, 25 do
					wait()
					script.Parent:Resize(1,-(1.3/25))
				end
			deb = false
		end
	end
end

model.Parent.click.ClickDetector.MouseClick:Connect(ChangingStatus)

put this somewhere and give it the correct value

local SIZE_INCREMENT = -- how much to change the size every time the loop runs (Seems to be 1.3/25 in the script you posted.)

Then, in the loop, instead of :resize(), do this.

script.Parent.Size += Vector3.new(0, SIZE_INCREMENT, 0)
script.Parent.CFrame *= CFrame.new(0, SIZE_INCREMENT/2, 0)

Change the order of the arguments if this doesn’t resize the correct face.

2 Likes