That error means you’re calling the require() function with an argument that isn’t a ModuleScript, e.g. passing a server Script or LocalScript as a parameter. So this has nothing to do with the Talents module’s code, but rather the script requiring Talents.
If you can confirm that game.ReplicatedStorage.Talents points to exactly one instance that is a ModuleScript, I have no idea what could be wrong unless you misread the error’s source or forgot to commit a script.
There was a folder with the same name forgot i was testing some morestuff,
but now i got a new problem
16:51:24.941 ReplicatedStorage.Talents:3: attempt to index nil with 'Value' - Server - Talents:3
16:51:24.941 Stack Begin - Studio
16:51:24.941 Script 'ReplicatedStorage.Talents', Line 3 - Studio - Talents:3
16:51:24.941 Stack End - Studio
16:51:24.941 Requested module experienced an error while loading - Server - Script:20
16:51:24.941 Stack Begin - Studio
16:51:24.941 Script 'Workspace.Ak47.Script', Line 20 - Studio - Script:20
16:51:24.941 Stack End - Studio
i thought code wouldn’t run in the module script?
(Edit, i have the values unique in each tool)
When you run require it goes through all of the code as though you just put the entire script in a function and called it (though it can’t access the variables of the script that required it directly). I don’t know where/if you are defining DmgV or gLevel in your module script but one or both are nil.
local tool = script.Parent
local FEvent = tool.fe
local REvent = tool.re
local FastC = require(tool.FastCastRedux)
local PC = require(tool.PartCache)
local cA = FastC.new()
local HttpService = game:GetService("HttpService")
local BFolder = workspace.BFolder
local BTemplate = BFolder:FindFirstChildWhichIsA("Part")
local shotTime = tick()
local fireRate = tool.FireRate.Value
local timeLimit = 2/3
local minS = 0.5
local maxS = 2
local EXP = tool.CurrentExp
local rEXP = tool.ReqExp
local gLevel = tool.GunLevel
local DmgV = tool.Damage
local M = require(game.ReplicatedStorage.Talents)
You’ve defined them in the script that you are calling require in. Module scripts have their own scope though. Just treat a module script as it’s own script because it kind of is. You can just access returned data in a module script from another script. Not the other way around though.
You can however make a function in that module script that you could use to pass in data, but then you can’t really use that data until the function is called.
i just made a quick fix with inputing the module script in the tool and then defining the values, althought this isnt what i really wanted as if i wanted to add more “Talents” i would need to go through every tool’s module script
(edit)
Never mind something else broke now
17:47:24.544 TestService: Exception thrown in your RayHit event handler: Unable to cast Dictionary to float - Studio
17:47:24.544 TestService: checkpoint Workspace.Ak47.Script:100 function onRayHit
Workspace.Ak47(50%>*2).FastCastRedux.Signal:64
Also on a unrelated note, is it better for each tool to have its own fastcast & partcache module or should i have each tool only use one module in replicated storage?