I was watching a tutorial on YouTube on how to create an intro loading screen for a game, however, mine just doesn’t seem to work. I followed all the steps and I have no idea what I’m doing wrong, I’ve been trying to pick at it for an hour now. Any advice or help? (not a scripter)
The code:
local ContentProvider = game:GetService("ContentProvider")
local holder = script.Parent.Holder
local assets = game:GetDescendants()
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local function start()
for i=1, #assets do
ContentProvider:PreloadAsync({assets[i]})
local percentage = math.floor(i/#assets * 100).."%"
holder.BarFrame.Assets.Text = "Assets Loaded: "..i.."/"..#assets
holder.BarFrame.Percentage.Text = percentage.."%"
holder.BarFrame.Bar:TweenSize(UDim2.fromScale(percentage/100, 1), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1)
end
wait(1)
holder:TweenPosition(UDim2.fromScale(0.5, -1.5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1)
end
It seems like you’re not actually calling the start() function anywhere in your script.
To fix this, you should add a line of code at the end of your script to call the start() function.
local ContentProvider = game:GetService("ContentProvider")
local holder = script.Parent.Holder
local assets = game:GetDescendants()
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local function start()
for i=1, #assets do
ContentProvider:PreloadAsync({assets[i]})
local percentage = math.floor(i/#assets * 100).."%"
holder.BarFrame.Assets.Text = "Assets Loaded: "..i.."/"..#assets
holder.BarFrame.Percentage.Text = percentage.."%"
holder.BarFrame.Bar:TweenSize(UDim2.fromScale(percentage/100, 1), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1)
end
wait(1)
holder:TweenPosition(UDim2.fromScale(0.5, -1.5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1)
end
start() -- Call the function above