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
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.