Loading Screen not working

I wanted to make a loading screen but the counter isn’t working and the bar isn’t moving. I don’t know how to make the 2 dots because it apparently shows 3 on devforum. I don’t know how to indent these 2 codes here in devforum, loadingScreen.Background.Counter.Text = "Loading: " … i … “/” …total
ContentProvider:PreloadAsync({v})

Edit: I finally know how to indent the codes, I had to do was use blur this for example I blurred this out, ’ ’ ’ '. I also know how to make it 2 dots, I just had to use Preformatted text with Ctrl + E.

Script starts here
– Credits to a YouTuber, Freakyyy

script.Parent:RemoveDefaultLoadingScreen()

local loadingScreen = script.ScreenGui
loadingScreen.Parent = game.Players.LocalPlayer.PlayerGui

local ContentProvider = game:GetService(“ContentProvider”)
local toLoad = workspace:WaitForChild(“RedwoodMap1”):GetDescendants()

local total = #toLoad

for i,v in pairs(toLoad) do

’ ’ ’ 'loadingScreen.Background.Counter.Text = "Loading: " ..i .. “/” ..total

’ ’ ’ 'ContentProvider:PreloadAsync({v})
end

wait(1)
loadingScreen.Background.Counter.Text = “Done”
wait(1)
loadingScreen:Destroy()

Video: Loading Screen - YouTube

What do you mean by not working? Please give us a descriptive information about the bug.

1 Like

You should use two dots instead of three when combining strings.

The counter isn’t working and the bar isn’t moving. I don’t know how to indent these 2 codes here. loadingScreen.Background.Counter.Text = "Loading: " … i … “/” …total
ContentProvider:PreloadAsync({v})

I’ll format your code so I can read properly.

script.Parent:RemoveDefaultLoadingScreen()

local loadingScreen = script.ScreenGui
loadingScreen.Parent = game.Players.LocalPlayer.PlayerGui

local ContentProvider = game:GetService(“ContentProvider”)
local toLoad = workspace:WaitForChild(“RedwoodMap1”):GetDescendants()

local total = #toLoad

for i,v in pairs(toLoad) do
Preformatted textloadingScreen.Background.Counter.Text = "Loading: " … i … “/” …total
Preformatted textContentProvider:PreloadAsync({v})
end
wait(1)
loadingScreen.Background.Counter.Text = “Done”
wait(1)
loadingScreen:Destroy()

@xaxan11 as what @Apicphis said, when concatenating strings you used two dots, not three dots.

I don’t know how I got 3 dots it was 2 before.

I did have 2 dots in my code but it apparently shows 3 in devfourm, when I edit it’s still 3 dots.

Is this a local script or server script?

So then switch it. Don’t waste your time.

I did have 2 dots in my code but it apparently shows 3 in devfourm, when I edit it’s still 3 dots. Also I’m gonna go to school. My code in Roblox Studio did have 2 dots but it isn’t working.

This is a local script, also I’m gonna go to school.

I was sleeping that’s why I didn’t answer. I finally fixed the 3 dots problem just by using preformatted text.

I was sleeping that’s why I didn’t answer.

That’s okay character limit

My code has 2 dots in Roblox studio but it doesn’t work. I finally fixed the 3 dots problem in devforum, I used the preformatted text.

I’m also going to school. character limit

Are you sure everything loaded in the script? Such as you trying to find the PlayerGui. I recommend waiting for the child, so it doesn’t skip any important things in the script. Please try this code, and see if it works, and always check if the ScreenGui actually has appeared in the PlayerGui, folder, else you have not declared something properly, which may cause this to happen.

script.Parent:RemoveDefaultLoadingScreen()
local plr = game.Players.LocalPlayer
local loadingScreen = script.ScreenGui
loadingScreen.Parent = plr:WaitForChild("PlayerGui")

local ContentProvider = game:GetService(“ContentProvider”)
local toLoad = workspace:WaitForChild(“RedwoodMap1”):GetDescendants()

local total = #toLoad

for i,v in pairs(toLoad) do
loadingScreen.Background.Counter.Text = "Loading: " ..i .. “/” ..total
ContentProvider:PreloadAsync({v})
end
wait(1)
loadingScreen.Background.Counter.Text = “Done”
wait(1)
loadingScreen:Destroy()

I would just like to point out that wait is going to get deprecated soon, switch to task.wait

Ok. character limit