Visible off but background still stays

tweening away didnt work so i tried turning the visibility off but the problem still stays which is confusing
dont mind the checking visibility, i forgot its in playergui but
i checked the playergui’s one and the visibility went off after the game has loaded but the background is still visible

https://medal.tv/games/roblox-studio/clips/i2dgqBkxcVmS7R8Zi/CoBrppF0SqWw?invite=cr-MSxKSnUsMjQwOTc3MzIzLA

this is the code

local ContentProvider =  game:GetService("ContentProvider")
local holder = script.Parent.barHolder
local assets = workspace: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)
	holder.Visible = false
end

start()
1 Like

sorry not sure how to post videos properly

Try this

local ContentProvider = game:GetService("ContentProvider")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local holder = script.Parent.barHolder
local assets = workspace:GetDescendants()

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), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1, true)
    end

    task.wait(1)

    holder:TweenPosition(UDim2.fromScale(0.5, -1.5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true, function()
        holder.Visible = false
        print("Holder visibility set to false")
    end)
end

print("Initial holder visibility:", holder.Visible)

start()

print("Final holder visibility:", holder.Visible)

still doesn’t work

1 Like

Try using ContentProvider:PreloadAsync()

local ContentProvider = game:GetService("ContentProvider")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local holder = script.Parent.barHolder
local assets = workspace:GetDescendants()

ReplicatedFirst:RemoveDefaultLoadingScreen()

local function start()
    local assetsLoaded = 0
    local totalAssets = #assets

    for i = 1, totalAssets do 
        ContentProvider:PreloadAsync({assets[i]}, function()
            assetsLoaded = assetsLoaded + 1
            local percentage = math.floor(assetsLoaded / totalAssets * 100)
            holder.assetCounter.Text = "Assets Loaded: " .. assetsLoaded .. "/" .. totalAssets
            holder.percentage.Text = percentage .. "%" 

            if assetsLoaded == totalAssets then
                holder:TweenPosition(UDim2.fromScale(0.5, -1.5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true, function()
                    holder.Visible = false
                    print("Holder visibility set to false")
                end)
            end
        end)
    end
end

print("Initial holder visibility:", holder.Visible)

start()

print("Final holder visibility:", holder.Visible)

i checked visibility and its still true though

btw also without changing the visibility, the tweening was supposed to tween the background away too but it didn’t. so if you know how to fix that can you think about that too thank you for trying btw

in the video, you were checking the visibility property of the ui in StarterGui, not the PlayerGui
does that work?

yeah i mentioned that in the post, now when i turn off the visibility from playergui it does go away though
but by script, its not working

i have no idea then, maybe try accessing the holder (not barHolder) frame instead?

local ContentProvider =  game:GetService("ContentProvider")
local barHolder = script.Parent.barHolder
local holder = barHolder.Parent
local assets = workspace:GetDescendants()
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local function start()
    for i =1, #assets do 
        local percentage = math.floor(i/#assets * 100)
        ContentProvider:PreloadAsync({assets[i]})
        barHolder.assetCounter.Text = "Assets Loaded: "..i.."/"..#assets
        barHolder.percentage.Text = percentage.."%" 
        barHolder.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)
	holder.Visible = false
end

start()

oh it works now… damn ive been tryna have this work for 2 days
i dont understand though, can you explain?

OHHHHHHH I GET IT
the general holder frame (not barHolder) IS the background, but you only disabled visibility of the barHolder, so the background stayed

wait but, without visibility, is it possible to make it disappear too? like by tweening bcs that was what holder:TweenPosition(UDim2.fromScale(0.5,-1.5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.1,true) was tryna do

yes, just perform that on the main holder