I'm trying to make a loading screen with tweening, but when I do so it finishes with it not being 100% full, I'm pretty sure everything is right, but it resets.

GIF of whats happening

local PlayerGUI = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local StarterGui = game.StarterGui
local frame = script.Parent.Frame
local base = frame.Bar
local bar = base.intBar
local indicator = base.loadingtext
local queue = game.ContentProvider.RequestQueueSize

local loadTween = bar:TweenSize(
    UDim2.new(1/queue, 0, 1, 0),
    Enum.EasingDirection.Out,
    Enum.EasingStyle.Sine,
    1,
    true
)
local endTween = bar:TweenSize(
    UDim2.new(1, 0, 1, 0),
    Enum.EasingDirection.Out,
    Enum.EasingStyle.Sine,
    1,
    true
)

PlayerGUI:SetTopbarTransparency(1) -- Makes Topbar Invisible

wait()
pcall(function()
    local starterGui = game:GetService('StarterGui')
    starterGui:SetCore("TopbarEnabled", false)
end) --Disable Topbar Buttons

game.ReplicatedFirst:RemoveDefaultLoadingScreen() -- Disables Roblox Loading Screen

while wait() do
    indicator.Text = "LOADING ASSETS... (" .. queue .. ")"
    bar.Size = UDim2.new(1/queue,0,1,0)
    
    if loadTween then
        print("Updated Loading Bar") 
    end
    
    local queue = game.ContentProvider.RequestQueueSize
    if queue == 0 then
        
        if endTween then
            print("Tween Ended") 
        end
        
        indicator.Text = "ASSETS LOADED!"
        wait(1)
        frame:TweenPosition(UDim2.new(0,0,1,0))
        break
    end
end

2 comments

0

Is there any errors in the output?

0

no there isn't it get what is expected from the output. @ChefDevRBLX