Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is this loading screen functioning properly?

It sounds like a stupid question I know and I'm probably stupid for not knowing the answer. I am making a custom loading screen and all seems well but when you join the game the screen goes down immediately. Maybe my connection is a bit fast or something like that. My main question is whether or not the queue size is zero as soon as the player joins because if so, that would explain why it drops down immediately, since the script waits for the queue size to be zero before tweening the GUI away. One last bit of info, I am using RequestQueueSize for this script.

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

replicatedfirst:RemoveDefaultLoadingScreen()

local newloading = game.ReplicatedFirst.Loading:Clone()

newloading.Host.Display.Text = message
newloading.Parent = game.Players.LocalPlayer.PlayerGui

local assets

local function update()
	assets = cp.RequestQueueSize
	newloading.Host.Asset.Text = "Assets left: "..assets
	
	return assets
end

while true do
	wait(0.016666666)
	local determine = update()
	if determine == 0 then
		break
	end
end

script.Parent.Loaded.Value = true

newloading.Host:TweenPosition(UDim2.new(0,0,1,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 1)

wait(1.5)

newloading:Destroy()

4 comments

0

Where does it actually start? Because if your local function is set when your script is already loading then I think it won't work.

0

It starts at the while true do loop

0

u gotta use a coroutine at line 20 because once there is a loop not inside a thread, anything after the loop wont work

0

Why would a coroutine be needed? Once determine = 0 the loop breaks and the code under it will run, which is what I want.

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.