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)
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.
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.