I have no idea why it won’t work. I’ve looked at tutorials and none of them seem to actually help me. Also, EasyStats is my custom module that creates leaderstats. I’ve tried removing as much of it’s functionality as well, to no avail. I’ve tested in Studio and live games. Please help!
My script:
local EasyStats = require(4350820620)
local ServerStorage = game:GetService("ServerStorage")
local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSave")
game.Players.PlayerAdded:Connect(function(Player)
EasyStats.new(Player, "Bites", 0)
EasyStats.new(Player, "Rebirths", 0)
local bites = Player.leaderstats.Bites
local rebirths = Player.leaderstats.Rebirths
local DataFolder = Instance.new("Folder", ServerStorage.RemoteData)
DataFolder.Name = Player.Name
local debounce = Instance.new("BoolValue", DataFolder)
debounce.Name = "Debounce"
local bitesData, rebirthsData
local success, errormsg = pcall(function()
bitesData = DataStore:GetAsync("bites-"..Player.UserId)
rebirthsData = DataStore:GetAsync("rebirths-"..Player.UserId)
end)
if success then
if bitesData then
bites.Value = bitesData
rebirths.Value = rebirthsData
end
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
local success, errormsg = pcall(function()
DataStore:SetAsync("bites-"..Player.UserId, EasyStats.Stat("Bites").Value)
DataStore:SetAsync("rebirths-"..Player.UserId, EasyStats.Stat("Rebirths").Value)
end)
end)
Also, there are no errors. Help greatly appreciated!