Request module experienced error while loading

It is error after error for me right now, and right now the newest one is:

Request module experienced error while loading

How do I fix this? Also the lines of code that are wrong are all the same:

local DataManager = require(game:GetService("ReplicatedStorage").DataManager)

2 Likes

The error means the module couldn’t load, not the script that requires it. You need to check in there instead

1 Like

Check replicated storage, make sure “DataManager” in there and make sure there is no grammar mistakes.

It means there is an error with the DataManager script. I don’t think it it the way that you are calling it that is a problem.

There is likely another error just before that one that is about the DataManager module.

This means that the DataManager module has errored while starting

Did you return the table in your module script? I had that happen if I didn’t return the table once.

Lots of replys thanks for that, but I have never used a Profile Service before so here is my script anything wrong?

local Players = game:GetService("Players")
local ProfileService = require(script.Parent.ProfileService)

local ProfileStore = ProfileService.GetProfileStore(
	"Player",
	{
		Coins = 0;
		GoldenHookOwned = false;
		GoldenHookEquipped = false;
		TPoseOwned = false;
		TPoseEquipped = false;

	}
)

local Profiles = {}

local function OnPlayerAdded(player)
	local profile = ProfileStore:LoadProfileAsync(
		"Player_" .. player.UserId,
		"ForceLoad"
	)

	if profile  then
		profile:ListenToRelease(function()
			Profiles[player] = nil
			player:Kick()
		end)

		if player:IsDescendentOf(Players) then
			Profiles[player] = profile
		else
			profile:Release()
		end
	else
		player:Kick()
	end
end
local function OnPlayerRemoving(player)
	local profile = Profiles[player]
	if profile then
		profile:Release()
	end
end

Players.PlayerAdded:Connect(OnPlayerAdded)
Players.PlayerRemoving:Connect(OnPlayerRemoving)

local DataManager = {}

function DataManager:Get(player)
	local profile = Profiles[player]

	if profile then
		return profile.Data
	end
end

return DataManager

Why are you using a module for ProfileService? It should be kept in the main script so you can easily modify it with playerProfile.Data.Whatever = true. I handle ProfileService in my main script for data handling.

I dont really know what that means, I just followed a tutorial

Data handling modules are more convenient, so you can use them in multiple scripts, not just your main one.