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?
1 | local contentprovider = game:GetService( "ContentProvider" ) |
2 | while wait( 1 ) do |
3 | if contentprovider.RequestQueueSize = = 0 then |
4 | script.Parent.Text = "Loaded!" |
5 | wait( 1 ) |
6 | script.Parent.Parent:Destroy() |
7 | end |
8 | end |
Use Remotes.
Server:
1 | local contentprovider = game:GetService( "ContentProvider" ) |
2 | contentprovider.Changed:Connect( function () |
3 | if contentprovider.RequestQueueSize = = 0 then |
4 | game:GetService( "ReplicatedStorage" ).RemoteEvent:FireClient(game.Players.LocalPlayer) |
5 | end |
6 | end ) |
Client:
1 | game:GetService( "ReplicatedStorage" ).RemoteEvent.OnClientEvent:Connect( function () |
2 | local plr = game.Players.LocalPlayer |
3 | plr.PlayerGui.NameOfYourGuiHere.ReferenceYourTextLabelHere.Text = "Loaded!" |
4 | wait( 1 ) |
5 | plr.PlayerGui.NameOfYourGuiHere:Destroy() |
6 | 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.