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

This loading bar only works on studio and not game, how can I fix it?

Asked by
aindev 4
6 years ago

I am making a loading bar in the bottom left corner of the game and for some reason it is not working, how can I fix this?

1local contentprovider = game:GetService("ContentProvider")
2while wait(1) do
3    if contentprovider.RequestQueueSize == 0 then
4        script.Parent.Text = "Loaded!"
5        wait(1)
6        script.Parent.Parent:Destroy()
7    end
8end
0
1. Script type 2. Don't use wait() as a condition 3. Don't use RequestQueueSize for loading bars User#19524 175 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

Use Remotes.

Server:

1local contentprovider = game:GetService("ContentProvider")
2contentprovider.Changed:Connect(function()
3if contentprovider.RequestQueueSize == 0 then
4game:GetService("ReplicatedStorage").RemoteEvent:FireClient(game.Players.LocalPlayer)
5end
6end)

Client:

1game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function()
2local plr = game.Players.LocalPlayer
3plr.PlayerGui.NameOfYourGuiHere.ReferenceYourTextLabelHere.Text = "Loaded!"
4wait(1)
5plr.PlayerGui.NameOfYourGuiHere:Destroy()
6end)
Ad
Log in to vote
0
Answered by 6 years ago

If you're doing it on the player or on local scripts, Then it doesn't work because on the studio it's not filtering enabled, but on the game, it's filtering enabled.

Answer this question