So this is my script that is also in ServerScripService
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local Workspace = game:GetService("Workspace")
local DataStore2 = require(ServerScriptService.DataStore2)
print("A")
-- Combine every key you use. This will eventually be the default, but for now read the "Gotchas" section to understand why we need this.
DataStore2.Combine("DATA", "money")
Players.PlayerAdded:Connect(function(player)
local moneyStore = DataStore2("money", player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local money = Instance.new("NumberValue")
money.Name = "Money"
money.Value = moneyStore:Get(1000) -- The "1000" means that by default, they'll have 1000 money
money.Parent = leaderstats
moneyStore:OnUpdate(function(newPoints)
-- This function runs every time the value inside the data store changes.
money.Value = newPoints
end)
leaderstats.Parent = player
end)
As you can see from this image both DataStore2 and my Money script are in there. also the other one does not affect this. So why is DataStore2 is not a valid member of ServerScriptService
So this is my script that is also in ServerScripService
As you can see from this image both DataStore2 and my Money script are in there. also the other one does not affect this. So why is DataStore2 is not a valid member of ServerScriptService