Advertisement
Dient

Untitled

Feb 11th, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. local TS = game:GetService("TweenService")
  2. local CP = game:GetService("ContentProvider")
  3.  
  4. local preloadObjects = workspace:WaitForChild("PreloadObjects")
  5.  
  6. local mainFrame = script.Parent:WaitForChild("MainFrame")
  7. local loadFrame = mainFrame:WaitForChild("LoadFrame")
  8. local bar = loadFrame:WaitForChild("Bar")
  9.  
  10. local progressLabel = bar:WaitForChild("ProgressLabel")
  11.  
  12.  
  13. for i = 1, #preloadObjects:GetDescendants() do
  14. CP:PreloadAsync({preloadObjects:GetDescendants()[i]})
  15.  
  16. bar.Size = UDim2.new(i / #preloadObjects:GetDescendants(), 0, 1, 0)
  17.  
  18. progressLabel.Text = math.floor(i / #preloadObjects:GetDescendants() * 100) .. "%"
  19. end
  20.  
  21.  
  22. local tween = TS:Create(mainFrame, TweenInfo.new(.75), {GroupTransparency = 1})
  23. tween:Play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement