local DS2 = require(script.Parent.DataStore2)
game.Players.PlayerAdded:Connect(function(plr)
local CoinsDataStore = DS2(“Coins”,plr)
local Folder = Instance.new(“Folder”, plr)
Folder.Name = “leaderstats”
local IntValue = Instance.new(“IntValue”,Folder)
IntValue.Name = “Coins”
IntValue.Value = 0
IntValue.Value = CoinsDataStore:Get()
CoinsDataStore:OnUpdate(function()
IntValue.Value = CoinsDataStore:Get()
end)
end)
game.Workspace:WaitForChild(“WinnerList”).ChildAdded:Connect(function(ch)
if game.Players:FindFirstChild(ch.Name) then
local CoinsDataStore = DS2(“Coins”,game.Players:FindFirstChild(ch.Name))
CoinsDataStore:IncrementAsync(100)
end
end)
game.Players.ChildRemoved:Connect(function(plr)
local CoinsDataStore = DS2(“Coins”,plr)
CoinsDataStore:Set()
end)
It won’t load if i require a module script.
You need to download the ModuleScript from GitHub. Then, you import it into Roblox and require that by doing require(path.to.module)
.
Issue is same. I tried it to set and get, but not works.