My output says unable to cast ray to content?

my output is in the title


local cp = game:GetService(“ContentProvider”)
local rep = game:GetService(“ReplicatedStorage”)

local imgs = rep:WaitForChild(“IntroPieces”)

local optionalAssets = {imgs:GetChildren()}
local disabledService = {
[“Lighting”] = false;


local ui = script:WaitForChild(“loadingUI”)
ui.Parent = game:GetService(“Players”).LocalPlayer:WaitForChild(“PlayerGui”)
local blur =“BlurEffect”, game:GetService(“Workspace”).CurrentCamera)
local frame = ui:WaitForChild(“Frame”)
local char = frame:WaitForChild(“Man”)

function animate()
char.Rotation = char.Rotation + 1

warn(“starting preload”)
local startTick = tick()


for i,service in pairs{game:GetChildren()} do
if not disabledService{service.Name} then

warn("preload done, time: "…string.sub(tick()-startTick, 1, 5)…“s”)

What line of the script are you getting this error on?
Also, have you tried basic debugging? You should always try to solve the issue yourself before dumping an entire script here.

line 32 and I have tried this is my first time using preload async.

You are trying to preload services, but for what? That is the underlying issue here, check if it is a Gui object :slight_smile:

I believe this error is due to the way you’re calling pairs.

Try changing this to pairs(game:GetChildren()) instead. When you call a function using {} instead of (), you’re passing whatever you put inside the {} in a single table.

What you were doing was roughly the same as doing this: pairs({{objects1,object2,object3}}).

According to the developer hub, PreloadAsync also loads the descendants of the passed instances, so by passing only the services, they’re preloading the entire DataModel.

In the future, please try to do some debugging on your own. Posting your entire code into a thread and asking for it to be fixed is improper use of this category.

As for your code, a notice that you should not be preloading your entire game. This defeats the purpose of preloading. Preload is intended only to push assets to the front of the download queue. If an asset hasn’t been used before, then it is pushed into the queue at the front and downloaded. Preload is not meant to speed up game loading time by passing everything through.

All assets should be download streamed in the background. Only preload assets you need immediately invisible and don’t do anything with the rest. Long loading times make for bad UX, contrary to belief that a loading screen and fully loading everything before starting the action makes gameplay better.