Images is not a valid member of ModuleScript

Hello everyone! I’m trying to preload the images of my game gui, but for some reason this error is happening: Images is not a valid member of ModuleScript. I’ve never used ModuleScripts before, so I got no idea what to do. Here’s my code:

--Local script at ReplicatedFirst
local ContentProvider = game:GetService("ContentProvider")
local ImagesModule = script.Images

local function checkFailed(contentId, Status)
  if Status == Enum.AssetFetchStatus.Failure then
    print("Failed:", contentId)
  end
end

ContentProvider:PreloadAsync(ImagesModule.images, checkFailed)
--ModuleScript inside the LocalSript
local images = {}
images.images = {
  "rbxassetid://10536397078",
  "rbxassetid://10536435527",
  "rbxassetid://10536440796",
  "rbxassetid://10529599606",
  "rbxassetid://10479528722",
  "rbxassetid://10629433764",
  "rbxassetid://10629445663",
  "rbxassetid://10629439770",
  "rbxassetid://10629425016"
}
return images

Here’s how everything looks like (also new studio icons sucks):
image

but for some reason this error is happening.

You forgot to mention the error.

1 Like

Thank you for pointing that, just fixed it :sweat_smile:

Is the ModuleScript required by the client (a local script)? If it is you may need to use WaitForChild to wait for the ‘Images’ folder to load/replicate.

I thought the same, but I tried fixing it by changing the variable local ImagesModule = script.Images to local ImagesModule = script:WaitForChild("Images") but nothing happened. But as I said, I’ve never used ModuleScripts before so I got no idea of what I’m doing

Oh, it’s a module script, I’m not familiar with the new icons yet. You need to require the module via require.

local ImagesModule = require(script.Images)

Thank you so much for your help!