What do you want to achieve?
I am creating a Loading Screen where the loading label would show whats its loading, I use the table to pair up strings i will later concatenate.
local AssetsToLoad = {
workspace == "Objects",
game.Lighting == "Lighting",
game.ReplicatedStorage == "Cache",
game.ReplicatedFirst == "Cache",
game.ServerStorage == "Server Storage",
game.ServerScriptService == "Server Scripts",
game.SoundService == "Sounds",
game.StarterGui == "User Interfaces",
game.StarterPack == "Tools",
game.StarterPlayer == "Starter Player Scripts",
game.Chat == "Communications",
game.Players == "Communications"
}
I also feel like i approached this in such a wrong way
i would be workspace, game.Lighting etc as you loop through the table
v would be “Objects”, “Lighting” etc as you loop through the table
I may have misunderstood your question so please rephrase if you did.
1 Like
Thats what i initially thought as well but: I is a number number and v is false I feel like i set up the table wrong
There’s a ton of threads on this already. I don’t specialise in this so I can’t help. Maybe start from here How to make a real assets loading bar? - #11 by russkiychelik02
1 Like
Ive read that multiple times already and what they are doing is not the same as what I am doing, I am trying to make a Loading Label show what the game is loading. For Example: Loading StarterGui, or Loading Workspace
FerbZides
(FerbZides)
July 17, 2022, 12:12pm
#7
This doesn’t work because workspace == "Objects"
is a boolean, meaning it would be AssetsToLoad[1] -- this would be your workspace boolean
, if you remove that one =
then it should work like so:
local AssetsToLoad = {
workspace = "Objects",
game.Lighting = "Lighting",
game.ReplicatedStorage = "Cache",
game.ReplicatedFirst = "Cache",
game.ServerStorage = "Server Storage",
game.ServerScriptService = "Server Scripts",
game.SoundService = "Sounds",
game.StarterGui = "User Interfaces",
game.StarterPack = "Tools",
game.StarterPlayer = "Starter Player Scripts",
game.Chat = "Communications",
game.Players = "Communications"
}
1 Like
I also tried this but it gave me syntax error underlines
FerbZides
(FerbZides)
July 17, 2022, 12:37pm
#9
Maybe a little formatting may do the trick:
local AssetsToLoad = {
workspace = "Objects",
Lighting = "Lighting",
ReplicatedStorage = "Cache",
ReplicatedFirst = "Cache",
ServerStorage = "Server Storage",
ServerScriptService = "Server Scripts",
SoundService = "Sounds",
StarterGui = "User Interfaces",
StarterPack = "Tools",
StarterPlayer = "Starter Player Scripts",
Chat = "Communications",
Players = "Communications"
}
game.someService
won’t work if you want to make a table you make it with variables that haven’t been referenced or mentioned.
1 Like
Forgot to respond back but i just did this:
local AssetsToLoad = {
['Workspace'] = "Objects",
['Lighting'] = "Lighting",
['ReplicatedStorage'] = "Cache",
['ReplicatedFirst'] = "Cache",
['ServerStorage'] = "Server Storage",
['ServerScriptService'] = "Server Scripts",
['SoundService'] = "Sounds",
['StarterGui'] = "User Interfaces",
['StarterPack'] = "Tools",
['StarterPlayer'] = "Starter Player Scripts",
['Chat'] = "Communications",
['Players'] = "Communications"
}
for i, v in pairs(AssetsToLoad) do
LoadingLabel.Text = "Loading "..v
ContentProvider:PreloadAsync(game:FindFirstChild(i):GetChildren())
wait(1)
end
Your formatting mightve worked too but I didnt look back thanks though!
2 Likes
It also works if you delete the quotation marks altogether in the dictionary.
local AssetsToLoad = {
Workspace = "Objects",
Lighting = "Lighting",
ReplicatedStorage = "Cache",
...
1 Like