Loading bar isnt going fully, loading screen isn't tweening away too

loading bar didnt go fully at 100% as shown below
image
the background is also staying there after the thing has loaded and others has been tweened away too, i tried making the frame transparency 1 and it does become transparency 1 but it still stays the same

image
properties are:
holder frame size: 1,0,1,0
holder frame anchorpoint: 0.5,0.5
holder frame position: 0.5,0,0.5,0
barholder frame anchorpoint: 0.5,0.5
barholder frame position: 0.5,0,0.5,0
barholder frame size: 0.4,0,0.06,0
UICorner’s corner radius: 0.15, 0
bar frame size: 1,0,1,0

local ContentProvider =  game:GetService("ContentProvider")
local holder = script.Parent.barHolder
local assets = game:GetDescendants()
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local function start()
    for i =1, #assets do 
        local percentage = math.floor(i/#assets * 100)
        ContentProvider:PreloadAsync({assets[i]})
        holder.assetCounter.Text = "Assets Loaded: "..i.."/"..#assets
        holder.percentage.Text = percentage.."%" 
        holder.bar:TweenSize(UDim2.fromScale(percentage/100,1) ) 
    end
    task.wait(1)
holder:TweenPosition(UDim2.fromScale(0.5,-1.5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.1,true)
end

start()```
1 Like

Try to remove the squirly brackets.

2 Likes

um i tried workspace:GetDescendants instead and it worked for the bar somehow

but background still doesnt go away after loaded

1 Like

Maybe take into account that some assets may not have loaded?
Also, you should really only do workspace’s descendants.

repeat task.wait(0.1) until game:IsLoaded()
local ContentProvider = game:GetService("ContentProvider")
local holder = script.Parent.barHolder
local assets = workspace:GetDescendants()
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local ts = game:GetService("TweenService")
local function start()
    local i = 0
    for _, asset in assets do
        i += 1
        local percentage = math.floor(i/#assets * 100)
        ContentProvider:PreloadAsync({asset})
        holder.assetCounter.Text = "Assets Loaded: "..i.."/"..#assets
        holder.percentage.Text = percentage.."%" 
        ts:Create(holder.bar, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage / 100, 1)}):Play()
    end
    task.wait(1)
    ts:Create(holder, TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.fromScale(0.5, -1.5)}):Play()
end

start()
1 Like

You need the {} because the argument must be an array with instances. {Instance}

1 Like

whole thing stops working after removing it

1 Like

ah, i heard that game:GetDescendants() can be for bigger games so thats why i used it

1 Like

@RoyaleHigh_KingFB I’ve updated the script with new tween mechanics, so you could try those out.

1 Like


uh this is the end result lol