Okkey, I put this code:
local PlayerStatManager = require(game.ServerStorage.PlayerStatManager)
I get this error:
ServerStorage is not a valid member of DataModel
I put this code:
local PlayerStatManager = require(game:GetService('ServerStorage').PlayerStatManager)
I get this error:
PlayerStatManager is not a valid member of ServerStorage
How to do it ?
If you want to make a LocalScript to access the ServerStorage and access ModuleScript then
--Inside of a script, place the script inside ServerScriptService, Rename the script "FuncAdder" local bindablefunc = Instance.new("RemoteFunction") bindablefunc.Name = AccessModuleScript local folder = Instance.new("Folder") folder.Name = "AccessServer" folder.Parent = workspace bindablefunc.Parent = folder
--Inside a LocalScript --Script and events all that stuff --When you want too use require, replace with this local Func = workspace.AccessServer:WaitForChild("AccessModuleScript") local playerstats = Func:FireServer() --Do whatever with playerstats
--Inside of ServerScriptService again, Rename this to "RequireInfo" local func=workspace.AccessServer:WaitForChild("AccessModuleScript") func.OnServerEvent:connect(function() local PlayerStatManager = require(game.ServerStorage.PlayerStatManager) return PlayerStatManager end
If you have trouble, contact me. How? Idk, also, i haven't tried the script yet
LocalScripts cannot access ServerStorage. Instead, use ReplicatedStorage. Also, if you don't already know, scripts cannot run in ServerStorage nor ReplicatedStorage.