Progress Bar not Working with TweenSize

So im doing a type of robbery game and what im trying to do is TweenSize the bar when more Cash Collected u get so here is the script but its not working, anyone can help

local player = game.Players.LocalPlayer

local container = game:GetService("StarterGui").BankRobberyUI.Container

local function format_number(v)

return tostring(v):reverse():gsub("%d%d%d", "%1,", (#tostring(v) - 1) / 3):reverse()

end

player:WaitForChild("CashCollected"):GetPropertyChangedSignal("Value"):Connect(function()

script.Parent.Text = "$" .. format_number(player:WaitForChild("CashCollected").Value).." / 2,500"

container.Bottom.Progress.Slider.Value:TweenSize(UDim2.new(1, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)

end)

Uhh, I tested it in studio and it works, check the function that has the role to start the tween if it is correct maybe?

You should be more specific about what’s going on. When you say “not working” do you mean that you are getting errors in the output or do you mean that the result you are getting is not what you want? If it’s errors, then state what the error message is (bonus points for showing what line or lines of code the error refers to). If it’s that you’re not getting the result you want, then state what’s going on. What is the end goal? What is happening instead? Does the bar not seem to be getting tweened? Does the bar seem to be getting tweened incorrectly? Answering these questions and any others you can think of will give readers far more information and allow people to help you more easily.

1 Like

Its not printing errors in the output , it just don’t want to work

It tweens but i want it to tween everytime the value of the cash collected change but its not tweening

Oooh now I understand to do this create a variable of the cash value and use this:

cash.Changed:Connect(function()
    --tween here
end)

You didn’t answer my questions. Stating that your code “just doesn’t want to work” is still the exact same statement you made in the original post.

What is it that’s not working? Do you mean that the tween isn’t playing? Do you mean that the tween is playing incorrectly? Please be more specific.

I suspect that the issue you should be stating is that the tween isn’t playing. I suspect this because one of the lines of code before the one calling TweenSize() contains a WaitForChild() function and it is very easy to let this function permanently yield your code. If you want to check if it’s the issue, put a print statement directly under the line with WFC with something like print("Reached!"). Then, run the code and look in the output. If you don’t see “Reached!” in your output, that means that that print statement is never reached and that the WFC function is permanently waiting. You should be able to solve your issue from here–assuming that your issue is that your GUI object is not getting tweened at all.

Wow I See You Making Robing Game Bro