Need help with tweening

Why is it tweening like this

i tried messing with the anchor point because that used to be a problem when i tried to make something like this

image
pretty explanatory how i want it

this is how its supposed to look like at 100%
image
could it be something with the sizing or do i actually need an anchor point?

local function updateMood(moodValue, bar, percent)
	local size = math.clamp(moodValue / 100, 0, 1)
	local targetSize = UDim2.new(size, 0, 1, 0)

	bar.Size = targetSize
	percent.Text = tostring(math.floor(size * 100) .. "%")

	local tween = TweenService:Create(bar, info, { Size = targetSize })
	tween:Play()
end

try the uiscale plugin and set everything to scale. this problem could also be due to your script

its not the script and i tried that

could you show the layout of the frames? What size is the parent frame?

then it has something to do with how you set up your frames or their offset and scale. try making all of them scale and see what happens.

all 4 of these frames have this
image
image

and the bar
image

could you show the layout of the frames

like this?
image

ye it looks like your setting the size to something greater then want you want the 100% to be, try this code instead which finds a value within 0 - 0.9 and keeps the y value locked at 0.4:

local function updateMood(moodValue, bar, percent)
	local size = math.clamp(moodValue / 100 * 0.9, 0, 0.9)
	local targetSize = UDim2.new(size, 0, 0.4, 0)

	bar.Size = targetSize
	percent.Text = tostring(math.floor(size * 100) .. "%")

	local tween = TweenService:Create(bar, info, { Size = targetSize })
	tween:Play()
end
3 Likes

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