PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Creating a Custom Loading Screen: Code Sample 4

Creating a Custom Loading Screen: Code Sample 4

Oct 01 2018, 3:19 AM PST

game:GetService("TeleportService").LocalPlayerArrivedFromTeleport:Connect(function(customLoadingScreen, data)
	spawn(function() 
		-- Spawn a function to set the top bar transparency as soon as the PlayerGui is created
		local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
		PlayerGui:SetTopbarTransparency(0) 
	end)
	local loadingGuiScript = script.AnimateLoadingGui:Clone() -- We can add a script to animate the customLoadingScreen now, it is static while the teleport is taking place.
	loadingGuiScript.Disabled = false
	loadingGuiScript.Parent = customLoadingScreen
	wait(5) -- Wait until we want to remove the custom loading screen
	customLoadingScreen:Destroy()
end)