Can't put Configuration in ReplicatedStorage folder

  1. What do you want to achieve? Keep it simple and clear!
    I want to make classes (which are moduleScripts) into configs inside replicatedStorage folders. What I do is in the constructor for the moduleScript, it passes a bindableEvent which signals another script (in serverScriptStorage) to make the config and put it in a folder.
  2. What is the issue? Include screenshots / videos if possible!
    It simply does not go in the folder in replicatedStorage!
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried to put it in the workspace instead and it works-but i won’t do that because it needs to be as organized as possible.

Here is my moduleScript:

baseAction = require(script.Parent.Parent.BaseActionModule)

targetAction = {}
targetAction.__index = targetAction
setmetatable(targetAction, baseAction)

function targetAction.new(name,ID,level,spellSchool,cost,targetRadius,areaRadius,properties,spellRoll,spellSuccess,spellFail,useMakeActionConfig)
	local newTargetAction = baseAction.new(name,ID,level,spellSchool,cost,properties,spellRoll,spellSuccess,spellFail,useMakeActionConfig)
	setmetatable(newTargetAction, targetAction)
	newTargetAction.targetRadius = targetRadius
	newTargetAction.areaRadius = areaRadius
	if useMakeActionConfig == true then
		game.ReplicatedStorage.ModuleConstructorEvents.TargetActionCreated:Fire(newTargetAction) 
	end
	return newTargetAction
end

return targetAction

the action it inherits from:

local action = {}

action.__index = action

function action.new(name,ID,level,spellSchool,cost,properties,spellRoll,spellSuccess,spellFail,useMakeActionConfig)
	local newaction = {}
	setmetatable(newaction, action)
	newaction.name = name
	newaction.ID = ID
	newaction.level = level
	newaction.spellSchool = spellSchool
	newaction.cost = cost
	newaction.properties = properties
	newaction.spellRoll = spellRoll
	newaction.spellSuccess = spellSuccess
	newaction.spellFail = spellFail
	newaction.useMakeActionConfig = useMakeActionConfig 
	return newaction
end

function action.findById(id)
	for i,v in pairs(action) do
		if v.ID == id then
			return v
		end
	end
	return nil
end



return action

the script that makes the config in serverScriptService:

local targetAction = require(game.ReplicatedStorage.ModuleScripts.ClassModules.ActionModules.Inherited.TargetActionModule)
local targetActionConfigs = game.ReplicatedStorage.ClassConfigs.ActionConfigs.TargetConfigs

function addValueToConfig(parent, value, name)
	if typeof(value) == "number" then
		local newValue = Instance.new("NumberValue")
		newValue.Value = value
		newValue.Parent = parent
		newValue.Name = name
	elseif typeof(value) == "string" then
		local newValue = Instance.new("StringValue")
		newValue.Value = value
		newValue.Parent = parent
		newValue.Name = name
	elseif typeof(value) == "boolean" then
		local newValue = Instance.new("BoolValue")
		newValue.Value = value
		newValue.Parent = parent
		newValue.Name = name
	elseif typeof(value) == "Instance" then
		local newValue = Instance.new("ObjectValue")
		newValue.Parent = parent
		newValue.Value = value
		newValue.Name = name
	elseif typeof(value) == "Vector3" then
		local newValue = Instance.new("Vector3Value")
		newValue.Value = value
		newValue.Parent = parent
		newValue.Name = name
	elseif typeof(value) == "table" then
		local newValue = Instance.new("Configuration")
		newValue.Parent = parent
		newValue.Name = name

		for i, v in ipairs(value) do
			addValueToConfig(newValue, v, "NoName")
		end
	end
end

game.ReplicatedStorage.ModuleConstructorEvents.TargetActionCreated.Event:Connect(function(targetAction)
	local newTargetActionConfig = Instance.new("Configuration")
	newTargetActionConfig.Name = targetAction.name .. "Config" 

	addValueToConfig(newTargetActionConfig, targetAction.name, "Name")
	addValueToConfig(newTargetActionConfig, targetAction.ID, "ID")
	addValueToConfig(newTargetActionConfig, targetAction.level, "Level")
	addValueToConfig(newTargetActionConfig, targetAction.targetRadius, "TargetRadius")
	addValueToConfig(newTargetActionConfig, targetAction.areaRadius, "AreaRadius")
	addValueToConfig(newTargetActionConfig, targetAction.spellRoll, "SpellRoll")
	addValueToConfig(newTargetActionConfig, targetAction.spellSuccess, "SpellSuccess")
	addValueToConfig(newTargetActionConfig, targetAction.spellFail, "SpellFail")
	addValueToConfig(newTargetActionConfig, targetAction.properties, "Properties")
	addValueToConfig(newTargetActionConfig, targetAction.spellSchool, "SpellSchool")
	addValueToConfig(newTargetActionConfig, targetAction.cost, "Cost")
	newTargetActionConfig.Parent = game.ReplicatedStorage.ClassConfigs.ActionConfigs.TargetConfigs


end)


…and the script in the workspace that makes the class:

local targetAction = require(game.ReplicatedStorage.ModuleScripts.ClassModules.ActionModules.Inherited.TargetActionModule)

--takes inspiration from bg3 toolkit example fireTouch, find here: 
--https://mod.io/g/baldursgate3/r/adding-a-new-spell-basic
local function createFireTouchSpell()
	local name = "FireTouch"
	local ID = "fire_touch"
	local level = 3
	local spellSchool = "Evocation"
	local cost = "ActionPoint:1;SpellSlotsGroup:1:1:3"
	local targetRadius = 1.5 
	local areaRadius = 3 
	local properties = nil

	local spellRoll = "not SavingThrow(Ability.Dexterity, SourceSpellDC())"

	local spellSuccess = "IF(Self()):RegainHitPoints(3d10); IF(not Self()):DealDamage(3d10,Fire,Magical)"

	local spellFail = "IF(Self()):RegainHitPoints((3d10)/2); IF(not Self()):DealDamage((3d10)/2,Fire,Magical)"
	local newAction = targetAction.new(
		name,
		ID,
		level,
		spellSchool,
		cost,
		targetRadius,
		areaRadius,
		properties,
		spellRoll,
		spellSuccess,
		spellFail,
		true 
	)

	print("Created TargetAction:", newAction)
end

createFireTouchSpell()