Hey! I’ve been making my game and I’ve ran into this issue 10s of times. I haven’t been able to figure out why this happens, so I end up having to rewrite the entire module. Does anyone know what the error Requested module experienced an error while loading
actually means and how to fix it?
- I’ve already searched the error up and looked everywhere for answers, none of which actually told me how to fix the problem
MODULE:
local DataManager = require(game.ReplicatedStorage.Modules.DataManager)
local PlantsFolder = script.Plants
local function PlantToModel(plant,Stage)
print("other1")
return PlantsFolder:FindFirstDescendant(plant.. Stage)
end
local PlantManager = {}
function PlantManager.Plant(plr,Plot,Tile,Plant)
local Data = DataManager:Get(plr)
if Tile.Main.Plant.Value == "None" then
Data.Plot.CanvasObjects[Tile.PrimaryPart.Serial.Value].Crop = Plant
local Clone = PlantToModel(Plant.. 1):Clone()
Clone.Parent = Tile
Clone:SetPrimaryPartCFrame(Tile.PrimaryPart.CFrame)
end
end
return PlantManager
Whenever I remove:
local DataManager = require(game.ReplicatedStorage.Modules.DataManager)
The entire game will run perfectly with no errors, is this a problem with the Data system? I’m currently using ProfileService to keep all my data. So if anyone has any ideas for what’s wrong, that would be amazing.
@loleris Could this be a possible ProfileService bug? I’m not sure. Heres the data manager incase this does actually have to do with ProfileService.
local Players = game:GetService("Players")
local ProfileService = require(game.ReplicatedStorage.Modules.ProfileService)
local ProfileStore = ProfileService.GetProfileStore(
"Player",
{
Cash = 0;
LoginTimes = 0;
RobuxSpent = 0;
Inventory = {};
Tools = {};
Avatar = {
Accessories = {},SkinColor = {R = 0,G = 0,B = 0},HairColor = {R = 0,G = 0,B = 0},Package = 0,Face = 0,Top = 0,Bottom = 0
};
Plot = {
Objs = 0,
Strs = 0,
CanvasObjects = {},
Structures = {}
};
Settings = {};
Whitelist = {};
}
)
local Profiles = {}
local function onPlayerAdded(player)
local profile = ProfileStore:LoadProfileAsync(
"Player_".. player.UserId,
"ForceLoad"
)
if profile then
profile:Reconcile()
profile:ListenToRelease(function()
Profiles[player] = nil
player:Kick()
end)
if player:IsDescendantOf(Players) then
Profiles[player] = profile
Profiles[player].Data.LoginTimes += 1
print(player.Name.. " has joined ".. Profiles[player].Data.LoginTimes.. " times.")
print(Profiles[player].Data)
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