So I'm having troubles with data stores despite the print debugging method working fully through. There seem to be no errors in output either. The script is in a folder in ServerScriptService.
local DSService = game:GetService("DataStoreService"):GetDataStore("KytesSave") local PlayersLeft = 0 game.Players.PlayerAdded:Connect(function(player) PlayersLeft = PlayersLeft + 1 local Kytes = Instance.new("IntValue") Kytes.Name = "Kytes" Kytes.Value = 0 Kytes.Parent = player local player_data pcall (function() player_data = DSService:GetAsync(player.UserId.."-Kytes") end) if player_data ~= nil then Kytes.Value = player_data else Kytes.Value = 0 end end) local bindableEvent = Instance.new('BindableEvent') game.Players.PlayerRemoving:Connect(function(player) pcall(function() DSService:SetAsync(player.UserId..'-Kytes', player.Kytes.Value) print("Saved") PlayersLeft = PlayersLeft - 1 bindableEvent:Fire() end) end) game:BindToClose(function() while PlayersLeft > 0 do bindableEvent.Event:Wait() end end)