Probably a little inefficient, seeing how this will go through duplicate assets as well, but this would be perfect for smaller games! A simple fix to this inefficiency would be to put a folder with all the unique assets to load either in the script, or somewhere else in ReplicatedFirst, and to loop through that instead of the entire game. This way HUGE games with hundreds of thousands of instances won't take absurdly long to load.
@@FrostedOven just add a variable somewhere in the top level of the code named 'skip' and have it set to false. then add 'if skip then break end' to the top of the main loop, and add a connection before the loop which sets 'skip' to true on a button click. make sure this button is located in the loading menu! note that this won't show the progress bar jump to the end, but it will skip the loading.
@@IncredulousFocus Would connection look like this: skipButton.MouseButton1Click:Connect(function() skip = true end) because it doesn't work when i test it also would it be Mousbuttonclick or activated
Thanks so much for this! (Note for others trying, be VERY careful with typing in the exact same things as in the video, one colon or different names can make everything stop working)
hi i was wondering if u can be kind enough to send me the code here on youtube, ive typed everything and nothing works :( the gui wont even show or the frame its just like when ever i click play i just play, no loading screen no frame so if u can that would be very kind of you :D thanks if u do btw
It doesn't work for me? In the end of chapter 5 he tests to see if it works, and I tried and it just loads me into a normal game without a loading screen. I went through all the script twice making sure everything was identical to his, but it still did not work.
To fix this script remove "local assets = game:GetDescendants()" ... this is too inefficient and will take WAY too long to load a large game. Change: if i == #assets then task.wait() end to if i < #assets then task.wait() end This will make it load way faster. If you want to slow it down change the task.wait to a value. NOTE: You should ALWAYS also put a SKIP button somewhere on your loading screen.
bruh if you put if i < #assets then it wont even load but skip to the end of the menu, meaning that there is no loading anymore, because at the start i is always smaller than the total of game assets to load
@@amraam8723 wrong. the var " i " is a count up to #assets and it cycles based on the task.wait. Meaning if you have 1000 assets and you set your wait to 1 second it will take 1000 seconds. Of course dont set your wait to 1 second. If you dont belive this add print(i) and print(#assets)
Hi I’m a scripter and most of this is outdated for line “clonedLoadingScreen.Background.DisplayAssetsLoaded.Text = “Loading Assets: “..i..”/“..#assets should have a “ at the end. If you go into view at the top and go to output, it will show you more hours that you have to fix.
This video did help with the layout, but i think i did tbe script correctly, but nothing is happening with the loading screen in-game, it is just on 100%and 24/1000 assets.
if somebody has image labels in his loading screen and it doesnt fade away, paste this code at the end and make sure that the trans is 0 for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if v:IsA("ImageLabel") then tweenService:Create(v, TweenInfo.new(0.5), {ImageTransparency = 1}):Play() end end
yo do you know a way for me to fix this? when it finished loading it's just stuck on a white screen, I'll send the code local replicatedFirst = game:GetService("ReplicatedFirst") local contentProvider = game:GetService("ContentProvider") local tweenService = game:GetService("TweenService") local players = game:GetService("Players") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("LoadingScreen") replicatedFirst:RemoveDefaultLoadingScreen() repeat task.wait() until game:IsLoaded() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets[i] local percentage = math.round(i / #assets * 100) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.Background.DisplayPercentage.Text = percentage.. "%" clonedLoadingScreen.Background.DisplayAssetsLoaded.Text = "Loading... "..i.."/"..#assets tweenService:Create(clonedLoadingScreen.Background.BarBackground.Bar, TweenInfo.new(0.2,Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play() if i % 17 == 0 then task.wait() end if i == #assets then task.wait(1) end end for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if v:IsA("ImageLabel") then tweenService:Create(v, TweenInfo.new(0.5), {ImageTransparency = 1}):Play() elseif v:IsA("TextLabel") then tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}): Play() end end
hi i was wondering if u can be kind enough to send me the code here on youtube, ive typed everything and nothing works :( the gui wont even show or the frame its just like when ever i click play i just play, no loading screen no frame so if u can that would be very kind of you :D thanks if u do btw
@@flyhigh4078 ik this is late but if you still need it here: local replicatedFirst = game:GetService("ReplicatedFirst") local contentProvider = game:GetService("ContentProvider") local tweenService = game:GetService("TweenService") local players = game:GetService("Players") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("LoadingScreen") replicatedFirst:RemoveDefaultLoadingScreen() repeat task.wait() until game:isLoaded() replicatedFirst:RemoveDefaultLoadingScreen() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets [i] local percentage = math.round(i / #assets * 100 ) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.Background.DisplayPercentage.Text = percentage.."%" clonedLoadingScreen.Background.DisplayAssetsLoaded.Text = "Loading Assets: "..i.."/"..#assets tweenService:Create(clonedLoadingScreen.Background.BarBackground.Bar, TweenInfo.new(0.2,Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play() if i % 5 == 0 then task.wait() end if i == #assets then task.wait(1) end end for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if v:IsA("Frame") then tweenService:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play() elseif v:IsA("TextLabel") then tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play() end end
hi i was wondering if u can be kind enough to send me the code here on youtube, ive typed everything and nothing works :( the gui wont even show or the frame its just like when ever i click play i just play, no loading screen no frame so if u can that would be very kind of you :D thanks if u do btw
But im Kind :) elseif v:IsA("TextLabel") then tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play() (example) = for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if v:IsA("Frame") then tweenService:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play() elseif v:IsA("TextLabel") then tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play() elseif v:IsA("UIStroke") then tweenService:Create(v, TweenInfo.new(0.5), {Transparency = 1}):Play() end) end)
@@KalleankaJul Thank you so much for this! Helped me out big time, I had to retype the script twice and STILL couldn't get it. Again, thank you SO much!
Was a little mad at first because it didnt work and i thought i had too throw away my 15 minutes. Then i realized i just made a spelling mistake and now it works perfectly. For anyone whos script isnt working: go over it until you spot the mistake
not sure why, followed the coding part exactly how u did, the part where the numbers are supposed to go up is NOT working its not really changing the text at all, I'm not sure what i did wrong
It doesn’t work for me. The gui doesn’t even show up and I have it enabled so I can’t even tell if it’s working. My backgrounds are also visible. I know he did one. The other one is for decoration and I know how to script around that.
im giving up yall, my map has nothing to load. go here 14:47 for where i am right now (THIS IS NOT THE WHOLE SCRIPT ⚠ local ReplicatedFirst = game:GetService("ReplicatedFirst") local contentProvider = game:GetService("ContentProvider") local tweenService = game:GetService("TweenService") local players = game:GetService("Players") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("LoadingScreen") ReplicatedFirst:RemoveDefaultLoadingScreen() repeat task.wait() until game:IsLoaded() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets[i] local percentage = math.round(1 / #assets * 100) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.background.DisplayPercantage.Text = percentage.. "%" if i % 5 == 0 then task.wait() end if i == #assets then task.wait(1) end end
i have no idea what i did incorrectly, but the loading screen itself wont show up. it doesnt seem i missed a line of code, or made any errors. i looked over the code three times and i didnt see any errors. Send help!
SAME IS UR CODE LIKE THIS ? local replicatedFirst = game:GetService("ReplicatedFirst") local contentProvider = game:GetService("ContentProvider") local tweenService = game:GetService("TweenService") local players = game:GetService("Players") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("Loading Screen") replicatedFirst:RemoveDefaultLoadingScreen() repeat task.wait()until game:IsLoaded() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets [i] local percentage = math.round(i / #assets * 100) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.Background.DisplayPercentage.text = percentage.."%" if i % 5 == 0 then task.wait() end if i == #assets then task.wait(1) end endlocal replicatedFirst = game:GetService("ReplicatedFirst") local contentProvider = game:GetService("ContentProvider") local tweenService = game:GetService("TweenService") local players = game:GetService("Players") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("Loading Screen") replicatedFirst:RemoveDefaultLoadingScreen() repeat task.wait()until game:IsLoaded() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets [i] local percentage = math.round(i / #assets * 100) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.Background.DisplayPercentage.text = percentage.."%" if i % 5 == 0 then task.wait() end if i == #assets then task.wait(1) end end
Hello, I wanted to say that I have a Main Menu with a lot of Buttons, but when I add a Loading Screen then main menu shows with it at same time, how do i make that first the loading screen pops up and then when loaded then Main Menu Appears?
I did this tutorial but for some reason, the bar wasn't moving, the loading text wasn't doing anything either. I dont know if this was from the code, or the scripts
Hey there! So the part where you added the tween transperancy isn't working for me. Could you please provide some more help? Other than that, no issues occurred and overall an amazing tutorial!
Oh another video, thank you so much for making this content. Continue pet simulator x series as long as you can until you will make full game. Love yours videos bcs I can lern from them and can make with you and your comunity my dream games and projects. Again than you so much, keep going bro!
@@twistyyel I am not making it rn but i think his scripts are always working bsc he is making them well so I think if it works for him it shoud work for you too
is there anyone that can put a copy of the whole script inside the comments, ive wrote it all out to what i thought but it doesnt seem to work for me, it all failed when i started to write the code for everything to dissapear
local replicatedFirst = game:GetService("ReplicatedFirst") local contentProvider = game:GetService("ContentProvider") local tweenService = game:GetService("TweenService") local players = game:GetService("Players") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("LoadingScreen") replicatedFirst:RemoveDefaultLoadingScreen() repeat task.wait() until game:IsLoaded() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets[i] local percentage = math.round(i / #assets * 100) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.Background.DisplayPercentage.Text = percentage.."%" clonedLoadingScreen.Background.DisplayAssetsLoaded.Text = "Loading Assets: "..i.."/"..#assets tweenService:Create(clonedLoadingScreen.Background.BarBackground.Bar, TweenInfo.new(0.2,Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play() if i % 50 == 0 then task.wait() end if i == #assets then task.wait(1) end end for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if v:isA("Frame") then tweenService:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play() elseif v:isA("TextLabel") then tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play() elseif v:isA("UIStroke") then tweenService:Create(v, TweenInfo.new(0.5), {Transparency = 1}):Play() end end
@@notcrewe452 i fixed it by making sure i typed "TextLabel" correctly. Here is the script: for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if v:IsA("Frame") then tweenService:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play() elseif v:IsA("TextLabel") then tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play() end end
been 8 months since i last developed the game where i used this tutorial. new bug... when it loads somewhere near 50% it just freezes in place. everything works normally when viewing through the server and everything's moving, except for the loading bar.
local replicatedFirst = game:GetService("ReplicatedFirst") local contentProvider = game:GetService("ContentProvider") local tweenService = game:GetService("TweenService") local players = game:GetService("Players") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("LoadingScreen") replicatedFirst:RemoveDefaultLoadingScreen() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets[i] local percentage = math.round(i / #assets * 100) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.Background.DisplayPercentage.Text = percentage.."%" clonedLoadingScreen.Background.DisplayAssetsLoaded.Text = "Loading Assets: "..i.."/"..#assets tweenService:Create(clonedLoadingScreen.Background.BarBackground.Bar, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play() if i % 5 == 0 then wait() -- Ожидаем один фрейм end if i == #assets then wait(1.5) -- Ожидаем одну секунду после загрузки последнего актива clonedLoadingScreen:Destroy() -- Удаляем экран загрузки после окончания загрузки end end
If your code isn't working then fix your problem by checking if "Enum.EasingDirection.InOut, -1, true), {Position" isn't "Enum.EasingDirection.InOut, -1, true){Position"
first when it popped up the assets weren’t loading, then i did everything else and it didnt load at ALL.. i’m so confused. i did everything and it doesn’t even show up on my screen 😭 help edit: so i fixed it but my assets won’t load.. i don’t know what’s going on😢😢
Was going well until you did the first test, I have gone through the code multiple times and checked the placement of the script and loading screen. It just never shows up and I don't get any errors whatsoever.
@@robotincinerator Again, I have already checked the placement of BOTH the script and loading screen, everything is checked out, covered over and over, and ready to go
FIX TO THE SCRIPT: local players = game:GetService("Players") local contentProvider = game:GetService("ContentProvider") local replicatedFirst = game:GetService("ReplicatedFirst") local tweenService = game:GetService("TweenService") local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local loadingScreen = script:WaitForChild("LoadingScreen") replicatedFirst:RemoveDefaultLoadingScreen() local assets = game:GetDescendants() local clonedLoadingScreen = loadingScreen:Clone() clonedLoadingScreen.Parent = playerGui for i = 1, #assets do local asset = assets[i] local percentage = math.round(i / #assets * 100) contentProvider:PreloadAsync({asset}) clonedLoadingScreen.Background.DisplayPercentage.Text = percentage.."%" clonedLoadingScreen.Background.DIsplayAssetsLoaded.Text = "Loading Assets: "..i.."/"..#assets tweenService:Create(clonedLoadingScreen.Background.BarBackground.Bar.Size, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play() if i % 5 == 0 then task.wait() end if i == #assets then task.wait(1) end end for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if v:IsA("Frame") then tweenService:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play() elseif v:IsA("TextLabel") then tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play() end end
Thank you so much ! I just have 1 problem : the Game Title,100% text and the assets text do not go away. the background does, but not the texts. Coul you help me with that ?