What I'm trying to do I'm trying to make a loading screen that show the amount of assets left, and has a loading bar.

My current scripts + Structure Script #1: Injects GUI into player (Local Script)

local gui = script.LoadingGUI

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Wait()
	gui:Clone().Parent = player.PlayerGui
end)

Script #2: What runs the loading bar + screen (Script)

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

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 queue == 0 then
		indicator.Text = "ASSETS LOADED!"
		bar.Size = UDim2.new(1,0,1,0)
		wait(1)
		frame:TweenPosition(UDim2.new(0,0,1,0))
	end
end

Structure : Code Block so it can have lines

--> Server Script Sevice
---> LoadingGUI (Script, Script #1)
----> LoadingGUI (ScreenGUI)
-----> Loading Screen (Local Script, Script #2)
-----> Frame
------> Bar (used for a outline of my loading bar)
-------> intBar (loading bar that moves right)
-------> loadingtext (Show how many assets left to load)
------> BG (background image for my Loading Screen)

I really just don't know what to do here, it just freezes up at a number, or it says assets loaded and ends the loading screen

2 comments

1

Could you please say which scripts are client-sided and which are server-sided?

0

Script #1 is local, Script #2 a normal script