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

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

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?

local contentprovider = game:GetService("ContentProvider")
while wait(1) do
	if contentprovider.RequestQueueSize == 0 then
		script.Parent.Text = "Loaded!"
		wait(1)
		script.Parent.Parent:Destroy()
	end
end

1 comment

0
  1. Script type 2. Don't use wait() as a condition 3. Don't use RequestQueueSize for loading bars

2 answers

✓ Accepted answer

Use Remotes.

Server:

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

Client:

game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function()
local plr = game.Players.LocalPlayer
plr.PlayerGui.NameOfYourGuiHere.ReferenceYourTextLabelHere.Text = "Loaded!"
wait(1)
plr.PlayerGui.NameOfYourGuiHere:Destroy()
end)

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.

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