Hello I’m currently trying to make a fillable container using math, you can see a demonstration of it below. I’ve got it working for the most part except for when it turns sideways the math seems to be off, you can find my code below, any help is appreciated thanks.
local Original = script.Parent.Size
script.Parent:GetAttributeChangedSignal("Amount"):Connect(function()
local Amount = script.Parent:GetAttribute("Amount")
local OriginPosition = script.Parent.Parent.Outside.Position
local OriginY = Original.X
local Size = (OriginY/100) * Amount
local Position = (OriginY - Size) / 2
script.Parent.Size = Vector3.new(Size, Original.Y, Original.Z)
script.Parent.Position = Vector3.new(OriginPosition.X, OriginPosition.Y - Position, OriginPosition.Z)
end)