Long story short, I made a gui that uses TweenSize but then unlike how every single tutorial out there works, mine works a bit like this: Imgur: The magic of the Internet sorry can’t upload here I’m new
while it should be something like this: Imgur: The magic of the Internet
the script:
stats:WaitForChild('Points',20).Changed:connect(function(v)
local pct = (v+(stats.Lap.Value*maxValue))/(maxValue*lapsRequired)
G:TweenSize(UDim2.new(pct,0,1,0))
end)
I guess that’s how TweenSize works? I mean I’m telling it to tween its size but not its position, but looking at all the other models and youtube videos, I guess it tween its position as well? To attempt to fix this problem, I have tried using the exact same code and ui ojects, but it didn’t work. I have also tried using TweenSizeAndPosition but it another weird thing happened(it went downward without me setting it to go downward) so I scrapped it.
Could someone help me to figure out why it’s behaving weirdly?
It’s not a scripting problem (though it can be fixed through a script easily), it’s more of a UI problem.
If you just make the inside frame smaller, it would fit better. If you need an example here is a demo place file I made which showcases this using a basic health bar with the correct method to do this. Demo.rbxl (41.6 KB)
Semi-related. Your code is really unclear and a massive mess.
Here’s an improved version:
stats:WaitForChild('Points',20)
stats.Changed:Connect(function(v) -- connect is deprecated
local pct = ( v+ (stats.Lap.Value * maxValue) )/ ( maxValue * lapsRequired ) -- added some spaces to make a complex equasion look less "scary"
G:TweenSize(UDim2.new(pct, 0, 1, 0)) -- spacing. you could and should give your variables descriptive names
end) -- Proper indentations
All this would make it easier on yourself, any future collaborators, and anyone who tries to help you.