Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I hide the game while loading?

Asked by
Kegani 31
6 years ago

Hello

I use this code to make a new loading screen and it works, however, I have noticed I can still see the game while loading, and I don't know how to prevent that.

In the wiki it is said we need to wait for the PlayerGui then insert the loading screen or something like that, I think it's done in this script but I'm not sure.

repeat wait() until game.Players.LocalPlayer:FindFirstChild("PlayerGui")
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
game.Players.LocalPlayer.PlayerGui:SetTopbarTransparency(0)
local ContentService = game:GetService("ContentProvider")
local bar = script.Parent.LoadingFrame.Underlay.Overlay
local logo = script.Parent.Logo
---Start Intro---
script.Parent.Title.Position = UDim2.new(0,0,-1,0)
logo.Position = UDim2.new(0.15,0,-1,0)
script.Parent.LoadingFrame.Position = UDim2.new(0,0,-1,0)
---End Positioning--

---Start Moving Positioning---
script.Parent.Title:TweenPosition(UDim2.new(0,0,0.2,0), "In","Bounce", 2)
script.Parent.LoadingFrame:TweenPosition(UDim2.new(0,0,0.4,0),"In", "Bounce",2)
wait(3)

---Loading Bar Action---
local AmountOfAssestsLoaded = script.Parent.LoadingFrame.AssetsLoaded
local AllAssets = game.ContentProvider.RequestQueueSize
AssetsLoaded = game.ContentProvider.RequestQueueSize
AmountOfAssestsLoaded.Value = game.ContentProvider.RequestQueueSize
while game.ContentProvider.RequestQueueSize > 0 do
 if game.ContentProvider.RequestQueueSize < AssetsLoaded then
  AmountOfAssestsLoaded.Value = game.ContentProvider.RequestQueueSize
  AmountOfAssestsLoaded.Changed:connect(function(assetstoload)
   local newx = 1 - AmountOfAssestsLoaded.Value / AllAssets
   bar:TweenSize(UDim2.new(0,1,0)"Out","Quad",0.5,true)
  end)
 end
 wait()
end
bar:TweenSize(UDim2.new(1,0,1,0),"Out","Quad",0.5,true)
---End Loading Bar Action---
wait(2)
---Send LoadingBar to the right---
script.Parent.LoadingFrame:TweenPosition(UDim2.new(1,0,.4,0),"Out","Quad",2)
--Send Logo Down--
logo.Visible = true
logo:TweenPosition(UDim2.new(0.35,0,0.5,0),"In","Quint",2)
wait(3)
script.Parent:TweenPosition(UDim2.new(1,0,0,0),"Out","Elastic",2)
script.Parent.Parent.Menu.MenuFrame.Logo.Visible = true

Does anyone know how to do this?

2 answers

Log in to vote
0
Answered by 6 years ago

You Can Solve This By Simply Doing A Size Change To 1,1

logo.size = {1,0, 1,0}

Just Put This Before The Position

Ad
Log in to vote
0
Answered by 6 years ago
for _, v in pairs(game:GetDescendants()) do
    if v:IsA"BasePart" and v.ClassName ~= "Terrain" then
        v.Transparency = 1
        game.Loaded:Wait()
        v.Transparency = 0
    end
end

Answer this question