Hello! I'm making a progress bar for my game and would like the color to go from red to green depending on how close it is to being done. Sorry if any questions are stupid as I don't code too much. Here is my current code for the progress bar.
local TweenService = game:GetService("TweenService")
local mainframe = script.Parent.Frame
local loadingscreen = mainframe["Loading Screen"]
local loadingbarframe = loadingscreen["Loading Bar Frame"]
local loadingbartext = mainframe.TextLabel
local queue = game.ContentProvider.RequestQueueSize
script.Value.Value = true
while script.Value.Value do
wait()
loadingbartext.Text = "Loading Assets (("..queue.."))"
loadingbarframe.Size = UDim2.new(1/queue, 0, 1, 0)
print(queue)
if queue == 0 then
script.Value.Value = false
loadingbartext.Text = "Loaded!"
loadingbarframe.Size = UDim2.new(1, 0, 1, 0)
wait(1)
mainframe:TweenPosition(UDim2.new(0, 0, 1, 0))
end
end

1 comment
Thank you so much! It works great!