Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need help with my startup ui, it seems to take too long to load/loads weirdly, can someone help?

So what I'm doing is that I'm doing an intro script and it basically stalls the time because the stuff in my game takes a while to load. However, it doesn't seem to work (time is way longer than expected, the number goes back) (take a look at the code to understand more) here is the code:

local loading = script.Parent.Frame.assets
local frame = script.Parent.Frame
local buttoon = frame.TextButton
local label = frame.TextLabel
frame.TextButton.MouseButton1Click:Connect(function(startup)
	wait (math.random(2))
	loading.Text = "Loading assets: 1 of 9"
	wait (math.random(1,6))
	loading.Text = "Loading assets: 2 of 9"
	wait (math.random(1,6))
	loading.Text = "Loading assets: 3 of 9"
	wait (math.random(1,6))
	loading.Text = "Loading assets: 4 of 9"
	wait (math.random(1,6))
	loading.Text = "Loading assets: 5 of 9"
	wait (math.random(3,6))
	loading.Text = "Loading assets: 6 of 9"
	wait (math.random(1,6))
	loading.Text = "Loading assets: 7 of 9"
	wait (math.random(5,11))
	loading.Text = "Loading assets: 9 of 9"
	wait (math.random(5,11))
	loading.Text = "Loading assets: 9 of 9"
	wait(1)
	loading.Text = "Loading Complete. Welcome."
	wait (0.1)
	frame.BackgroundTransparency=0.1
	buttoon.BackgroundTransparency=0.1
	loading.BackgroundTransparency=0.1
	label.BackgroundTransparency=0.1
	wait (0.1)
	frame.BackgroundTransparency=0.2
	buttoon.BackgroundTransparency=0.2
	loading.BackgroundTransparency=0.2
	label.BackgroundTransparency=0.2
	wait (0.1)
	frame.BackgroundTransparency=0.2
	buttoon.BackgroundTransparency=0.2
	loading.BackgroundTransparency=0.2
	label.BackgroundTransparency=0.2
	wait (0.1)
	frame.BackgroundTransparency=0.3
	buttoon.BackgroundTransparency=0.3
	loading.BackgroundTransparency=0.3
	label.BackgroundTransparency=0.3
	wait (0.1)
	frame.BackgroundTransparency=0.4
	buttoon.BackgroundTransparency=0.4
	loading.BackgroundTransparency=0.4
	label.BackgroundTransparency=0.4
	wait (0.1)
	frame.BackgroundTransparency=0.5
	buttoon.BackgroundTransparency=0.5
	loading.BackgroundTransparency=0.5
	label.BackgroundTransparency=0.5
	wait (0.1)
	frame.BackgroundTransparency=0.6
	buttoon.BackgroundTransparency=0.6
	loading.BackgroundTransparency=0.6
	label.BackgroundTransparency=0.6
	wait (0.1)
	frame.BackgroundTransparency=0.7
	buttoon.BackgroundTransparency=0.7
	loading.BackgroundTransparency=0.7
	label.BackgroundTransparency=0.7
	wait (0.1)
	frame.BackgroundTransparency=0.8
	buttoon.BackgroundTransparency=0.8
	loading.BackgroundTransparency=0.8
	label.BackgroundTransparency=0.8
	wait (0.1)
	frame.BackgroundTransparency=0.9
	buttoon.BackgroundTransparency=0.9
	loading.BackgroundTransparency=0.9
	label.BackgroundTransparency=0.9
	wait (0.1)
	frame.BackgroundTransparency=1
	buttoon.BackgroundTransparency=1
	loading.BackgroundTransparency=1
	label.BackgroundTransparency=1
	wait (1)
    script.Parent.Frame.Visible=false
end)

like erm yeah and pls help

4 comments

0

You could use for loops,

0

Also if you want a "good" loading screen, use PreloadAsync (https://www.youtube.com/watch?v=1DvEdRTATW0)

0

bro??? this isn't a loading screen?? this is just making players wait for NO reason, roblox has their own loading screen. the solution to this is to just REMOVE IT

0

People like to make their own loading screen, because sometimes the Roblox loading screen loads too fast, causing things to be not loaded. People like to have a specific style of game, and the Roblox loading screen doesn't cut it

2 answers

✓ Accepted answer

You could also skip the random text generation and just have a loading bar. I did all the gui making so you don't have to make all the loading bar ui :)

https://www.roblox.com/library/6797632498/Loading-screen

This is how to bar generates by the way.

 local screen = math.random(1,3)

if screen == 1 then
	print '1'
	script.Parent.Parent.Parent.Parent.Enabled = true
	wait(2)
    
	script.Parent:TweenSize(UDim2.new(.3, 1, 1), "Out", "Linear", 2, true)
	wait(2)
	script.Parent:TweenSize(UDim2.new(.5, 1, 1), "Out", "Linear", 1, true)
	wait(3)
	script.Parent:TweenSize(UDim2.new(1, 1, 1), "Out", "Linear", 1, true)


	wait(1)
	script.Parent.Parent.Parent.Parent.Enabled = false
	wait(1)
	script.Parent:TweenSize(UDim2.new(0, 0, 0), "Out", "Linear", 1, true)

end

if screen == 2 then
	print '2'
	script.Parent.Parent.Parent.Parent.Enabled = true
	wait(2)
    
	script.Parent:TweenSize(UDim2.new(.1, 1, 1), "Out", "Linear", 3, true)
	wait(1)
	script.Parent:TweenSize(UDim2.new(.4, 1, 1), "Out", "Linear", 2, true)
	wait(4)
	script.Parent:TweenSize(UDim2.new(.7, 1, 1), "Out", "Linear", 3, true)
	wait(1)
	script.Parent:TweenSize(UDim2.new(1, 1, 1), "Out", "Linear", 1, true)


	wait(1)
	script.Parent.Parent.Parent.Parent.Enabled = false
	wait(1)
	script.Parent:TweenSize(UDim2.new(0, 0, 0), "Out", "Linear", 1, true)
end
if screen == 3 then
	print '3'
	script.Parent.Parent.Parent.Parent.Enabled = true
	wait(2)
    
	script.Parent:TweenSize(UDim2.new(.6, 1, 1), "Out", "Linear", 2, true)
	wait(2)
	script.Parent:TweenSize(UDim2.new(.8, 1, 1), "Out", "Linear", 3, true)
	wait(3)
	script.Parent:TweenSize(UDim2.new(1, 1, 1), "Out", "Linear", 1, true)


	wait(1)
	script.Parent.Parent.Parent.Parent.Enabled = false
	wait(1)
	script.Parent:TweenSize(UDim2.new(0, 0, 0), "Out", "Linear", 1, true)
end

script.Parent.Parent.Parent.Visible = false

Hope this is helps :D

first thing you can do is use :PreloadAsync() and :RemoveDefaultLoadingScreen(). Here is how you do it:

local RF = game:GetService("ReplicatedFirst")
local CP = game:GetService("ContentProvider")
local frame = script.Parent.Frame
local loading = frame.assets
local Load = CP.RequestQueueSize
local buttoon = frame.TextButton
local label = frame.TextLabel

itemstopreload = {} -- insert the assets that you need loaded right away in this table

RF:RemoveDefaultLoadingScreen() -- I think you know what this does
CP:PreloadAsync(itemstopreload) -- preloads the assets in the table

loading.Text = "Loading Assets"

if Load == 0 then
	loading.Text = "All Assets Loaded."
	for i = 0, 1, 0.1 do -- a for i loop.
		frame.BackgroundTransparency = frame.BackgroundTransparency + 0.1
		buttoon.BackgroundTransparency = buttoon.BackgroundTransparency + 0.1
		buttoon.TextTransparency = buttoon.TextTransparency + 0.1
		loading.BackgroundTransparency = loading.BackgroundTransparency + 0.1
		label.BackgroundTransparency = label.BackgroundTransparency + 0.1
		label.TextTransparency = label.TextTransparency + 0.1
	end
end

some links for you to learn the stuff I used in this script

for i loop

ContentProvider Service

RemoveDefaultLoadingScreen (ReplicatedFirst function)

This discussion is preserved as it was. New answers, comments, and votes are closed.