Few flaws with loading script

Hello, i’ve been working on a loading script for about an hour now and I just tested it and found quite a few flaws. I just can’t think about where the problem is coming from?

Currently, the flaws are:

  1. The Game ID never loads.
  2. The game version is 0?

What it shows:

My script:

local BG = script.Parent
local Logo = BG.Logo
local GameID = BG.GameID
local GameVers = BG.GameVersion
local ItemsLeft = BG.ItemsLeft

GameID.Text = "Game ID: " .. game.JobId
GameVers.Text = "Game Version: " .. game.PlaceVersion



while game.ContentProvider.RequestQueueSize > 0  do
wait(.1)
ItemsLeft.Text= game.ContentProvider.RequestQueueSize.." items left to load..."
end

while wait(.1) do

Logo.Rotation = Logo.Rotation +1

end

Anything helps!
Edit: I was able to fix the items left to load, and the logo spinning.
However, there is still some problems. They have been updated above.

For the spin you can make a new script with render stepped https://developer.roblox.com/en-us/api-reference/event/RunService/Stepped that would be a good place to start

1 Like

That worked to fix 2 items on the list, great! I’ll mark you as the solution since it did fix the main issue. A loading screen isn’t a loading screen if it doesn’t load anything, right?

1 Like

for the game id do game.GameId that should work

Wouldn’t that give the URL ID? I’m hoping to get the Server ID. I just, for some reason, named it Game ID. Yknow, the ID that has
XXX-XXX-XXX-XXX etc etc

When getting the place version, it will always return/print 0 in studio and if read from client. The JobID is the same situation, in StuioID and if read from the client it will result with an empty string. To retrieve these on the client I recommend using a RemoteFunction.

Also, this is just a personal thing but it is not recommended to use RequestQueueSize as the RequestQueueSize is constantly increasing and decreasing when assets are being loaded. You should create a table with all the assets you want to be loaded and then use PreloadAsync() to load these!

So you want the place id in the game?

I was looking into using PreloadAsync but I didn’t know how to use it to just load all things in Workspace and starterUI. I thought the documentation for it was confusing >.<

@pasdalover yes

then do game.PlaceId instead of game.GameId that should fix it

1 Like

Heres an example from my Gui.
To ‘Load’ everything in all Sections of the game do;

   local WA = {}
     local function Scan(this)
     for i, v in pairs(this:GetDescendants()) do

    table.insert(WA, v)

    end

    end

    local Service = {

    "Lighting",

    "InsertService",

    "ContentProvider",

    "CollectionService",

    "RunService",

    "SoundService",

    "BadgeService",

    "Selection",

    "GuiService",

    "UserInputService",

    "Debris",

    "TeleportService",

    "Chat",

    "PhysicsService",

    "AssetService"

    }

    for i=0, #Service, 1 do

    game:GetService(tostring(Service[i]))

    end

    Scan(game.Players)

    Scan(game.StarterGui)

    for i=0, #Service, 1 do

    if game:GetService(tostring(Service[i])) ~= nil then

    Scan(game:GetService(tostring(Service[i])))

    end

    end

    for i=0, #WA, 1 do

    Front.Size = UDim2.new(i/#WA+0, 0, 1, 0)

    if WA[i] ~= nil then

    --Loading.Text = " Loading: " .. tostring(WA[i])

    end

    wait(0.04)

    end

    Loading.LocalScript.Disabled = true

    wait(.1)

    Loading.Text = " Loading: Completed."

    --script.Parent.MainFrame.MainScript.Disabled = false

    local function RGB(r,g,b)

    return Color3.new(r/255,g/255,b/255)

    end

    local Color = Front.BackgroundColor3

    wait()

    script.Parent:TweenPosition(UDim2.new(-2,0,0,0), "Out", "Linear", 2)

    script.Parent.Parent.Play:TweenPosition(UDim2.new(0,0,0,0), "Out", "Linear", 1)
1 Like

Thank you for helping me put that together! I will implement that now. I do have another problem, and wasn’t sure if I should just open a new post or not. I’ll just ask you?

The LocalScript in ReplicatedFirst never parents the loadingscreen for some reason.
any thoughts?

local ReplicatedFirst = game:GetService("ReplicatedFirst")
ReplicatedFirst:RemoveDefaultLoadingScreen()
script.LoadingScreen.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")

(i recommend) Setting the Gui Property Enabled to false
For me using a Intro, i would add a local script in that gui and it should have:

script.Parent.Enabled = true

When a player joins it auto loads it for each individual player.

Use this if you dont want to be cloneing the gui.

You Can ask me if you want to know how to clone it into the PlayerGui Instead.

1 Like

Alrighty, so I tried to use your PreloadAsync script and I think I messed something up? I’m not the best when it comes to ( what seems like complicated ) stuff.

It works, but it stays on ‘MeCommand’?

   local LoadTable = {}

 local function Scan(this)
 for i, v in pairs(this:GetDescendants()) do
table.insert(LoadTable, v)
end
end



local Service = {
"Lighting",
"InsertService",
"ContentProvider",
"CollectionService",
"RunService",
"SoundService",
"BadgeService",
"Selection",
"GuiService",
"UserInputService",
"Debris",
"TeleportService",
"Chat",
"PhysicsService",
"AssetService"
}

for i=0, #Service, 1 do
game:GetService(tostring(Service[i]))
end

Scan(game.Players)
Scan(game.StarterGui)

for i=0, #Service, 1 do
if game:GetService(tostring(Service[i])) ~= nil then
Scan(game:GetService(tostring(Service[i])))
end
end

for i=0, #LoadTable, 1 do
if LoadTable[i] ~= nil then
ItemsLeft.Text = "Currently Loading: " .. tostring(LoadTable[i])
end
end

Thank you again for helping me through this! Usually people just stop replying…

1 Like

Whats ‘Me Command’ ? Is that the Text?

Yeah, that changes to ‘MeCommand’ and stays there

Im wondering how does it get MeCommand. Hmmm. idk why it would do that.

It’s probably one of the items inside the services thats being loaded :?

I Found some info on /me command.

Me Command

yeah so I tried changing and simplifying the script a lil bit, and this is what I got:

 local LoadTable = {}


local Service = {
"Lighting",
"InsertService",
"ContentProvider",
"CollectionService",
"RunService",
"SoundService",
"BadgeService",
"Selection",
"GuiService",
"UserInputService",
"Debris",
"TeleportService",
"Chat",
"PhysicsService",
"AssetService"
}


table.insert(LoadTable, #LoadTable+1, Service)

for i,v in #LoadTable do

game:GetService(v)
ItemsLeft.Text = "Currently Loading : ".. v

end

You think this would work?
how’d I check if it’s the last one in the table tho to load lmao, hm

To First Get the Number of items in the table, do,

print(#Service)

Then Insert this code after the game:GetService(v).

if v = "AssetService" then
print("On Last Service.")

Correction: You Probably Should have made this a new topic. Just Keep hat in mind next time.

1 Like