Hello.
Currently I have a script that goes through all the modules under a directory. It stores the “Incantation” into a table inside the script that is equal to the module itself, for effiency. I am trying to just store the incantation into a module located in ReplicatedStorage as right now everyone is being scripted in ServerScriptService. For some reason when this runs it stores everything in the script fine but when I try and script with the module in ReplicatedStorage it acts as if nothing is their.
Hopes someone can help!
Server Script
--// Services
local Players = game:GetService('Players')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
--// Items
--# Objects
local Modules = ReplicatedStorage:FindFirstChild('Modules')
local GlobalStored = require(Modules:FindFirstChild('GlobalStored'))
--# Variables
local groupId = 15625652
local Stored = {}
--// Scripts
--# Chat
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
local loweredMessage = string.lower(Message)
for incantation, module in pairs(Stored) do
if loweredMessage == incantation then
local rankInGroup = Player:GetRankInGroup(groupId)
if rankInGroup >= module['Rank'] then
module['Activate'](Player)
elseif module['Rank'] == -1 then
module['Activate'](Player)
end
end
end
end)
end)
--# Init
function Init()
--# Spell Info
for _, Spell in ipairs(script.Parent:GetChildren()) do
if Spell:IsA('ModuleScript') then
Spell = require(Spell)
Stored[Spell.Incantation] = Spell
end
end
GlobalStored['Incantations'] = Stored
print('Successfully instalized all spells.')
end
Init()
ReplicatedStorage Module
local GlobalStored = {
['Incantations'] = {}
}
return GlobalStored
I need to be able to insert this into the table so it looks like this.

Locations:

