Few flaws with loading script

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

There’s a couple of things that need to be addressed here. I’m going bottom up in terms of how I address these, to note.

  1. The last item in a table is equivalent to the number of items in a table. Instead of checking the value, check the indice. @iSkepticalBoi
if i == #Service then
    print("On last service.")
end
  1. Calling GetService on services does not make them load. It returns a service or inserts it if it does not exist in the DataModel. It doesn’t benefit you in any way to create a list of services and call GetService on all of them.

  2. Do NOT call PreloadAsync on all the contents of your place. Your place has a queue of assets that need to be downloaded so they can be displayed or rendered to the client. PreloadAsync pushes the items of request to the front of the list. Pushing everything to the front of the list effectively pushes nothing to the list.

    • You should only be preloading items you want the client to see first and immediately.

    • Long loading screens are horrid for UX design. You should be aiming to load as little as possible and let the rest of the download queue pass through in the background.

    • Anything that does not have an AssetId does not need to be preloaded.

  3. Parent your cover screens to the PlayerGui first before calling RemoveDefaultLoadingScreen. This will remove any potential discrepancies between what the player sees before their Roblox loading screen is removed and when your scripts take effect.

  4. You can shortcut any kind of loop or frame-bound code running with TweenService. Create an infinite tween that rotates the logo and you’re set.

1 Like