:Resize() Only Adds Up The Size Value

In the following script, there is an issue concerning the built-in function :Resize() . This function requires two parameters: one from the Enum.NormalId category and the resize amount. However, it appears that the function is only adding to the size of the part rather than adjusting its dimensions.

local Flask = script.Parent
local LiquidPart = Flask:FindFirstChild("LiquidPart")

local LiquidVolume = Flask.LiquidVolume
local LiquidColor = Flask.LiquidColor

LiquidVolume:GetPropertyChangedSignal("Value"):Connect(function()
	LiquidPart:Resize(Enum.NormalId.Right, LiquidVolume.Value)
end)

LiquidColor:GetPropertyChangedSignal("Value"):Connect(function()
	LiquidPart.Color = LiquidColor.Value
end)

I think this could’ve been intended only for the Resize tool of Studio, but keeping track of the Part’s Size can also work…?

im triying rn without using the function maybe we can get the current size and add up to that after the size change im trying that rn

yeah it worked i did like this:

local initialSize = LiquidPart.Size
LiquidVolume:GetPropertyChangedSignal("Value"):Connect(function()
    local newSize = initialSize + Vector3.new(LiquidVolume.Value, 0, 0)
    
    LiquidPart.Size = newSize
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.