Local:
local ToolsManager = require(game.ReplicatedStorage.toolsManager)
Module:
wait(0.3)
local ToolsManager = {}
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local ServerScriptService = game:GetService("ServerScriptService")
--local Workspace = game:GetService("Workspace")
local DataStore2 = require(ServerScriptService.DataStore2)
DataStore2.Combine("DATA", "warehouse", "backpack", "hand")
function ToolsManager.buy(toolName)
local warehouseStore = DataStore2("warehouse", player)
local warehouseTools = warehouseStore:Get({})
warehouseTools.insert(toolName)
warehouseStore:Set(warehouseTools)
print("Buy "..toolName)
end
return ToolsManager
so why, then I get this error: although I just want to get a modular script
Looking above, I saw that I have the following error above:
DataStore2 is not a valid member of ServerScriptService “ServerScriptService”
local DataStore2 = require(ServerScriptService.DataStore2)
that is, there I can’t get another modular script. So I explain the final situation in the module script, I get the module script and get it locally, but I get an error, why?
