My script works just fine in Studio, but it doesn't work online in a game with filtering enabled for some reason. I don't know if it's due to it being Filtering Enabled, or if I'm missing a value or two in order for this to work in-game/online.
Any help would be appreciated.
local DataStore = game:GetService("DataStoreService") local ds = DataStore:GetDataStore("CreditsSaveSystem") game.Players.PlayerAdded:connect(function(player) local leader = Instance.new("Folder",player) leader.Name = "leaderstats" local Credits = Instance.new("IntValue",leader) Credits.Name = "Credits" Credits.Value = ds:GetAsync(player.UserId) or 0 ds:SetAsync(player.UserId, Credits.Value) Credits.Changed:connect(function() ds:SetAsync(player.UserId, Credits.Value) end) end) game.Players.PlayerRemoving:connect(function(player) local ls = player:WaitForChild("leaderstats") ds:SetAsync(player.UserId, ls.Credits.Value) end)