I am coding a Loading screen for my game, but I am having several errors and it's just not working. Here is my script:
wait(0.5) --to load I guess
repeat wait(0.1) until game.Players.LocalPlayer --pretty sure this waits for player
print(game.Players.LocalPlayer.Name)
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
PlayerGui:SetTopbarTransparency(0.5)
local screen = PlayerGui:WaitForChild("Loading")
local Frame = screen:WaitForChild("Frame")
local Load= Frame:WaitForChild("Load")
local Label=screen:WaitForChild("TextLabel")
-- Get the service
local Content = game:GetService("ContentProvider")
-- Deal with requests
local TotalRequests = Content.RequestQueueSize -- How many requests there are
local RequestsLeft = TotalRequests -- Basically copy the TotalRequests, but this is the variable we'll be updating in our loop.
Label.Text=(RequestsLeft)
while RequestsLeft > 0 do --nothing in here works
wait(0.1) --for loop so it doesn't crash
RequestsLeft = Content.RequestQueueSize --keeps changing
if RequestsLeft > TotalRequests then
TotalRequests = RequestsLeft
end
Load.Text=(((TotalRequests - RequestsLeft) / TotalRequests * 100).. "%") -- The equation for the percentage
end
Frame.Visible=false-- this happens
When I test it in studio, it won't work, but at least the frame shows up (The text label saying 0%) and then disappears. Online, it just shows the regular loading screen and done. Someone please help?
This appears when I test it on server:
14:59:03.613 - New connection from 127.0.0.1|64245 14:59:03.786 - Replication: Can't create default object of type Players
Player -1 added
Someone please help?

2 comments
That error message is due to something enternal on Roblox's end
You obviously didn't write this yourself.