My Server is printing this when I exit my game:
19:29:02.636 - Not running script because past shutdown deadline.
Any Tips?
Here's my script:
local datastores = game:GetService("DataStoreService"):GetDataStore("MoneyDataStore")
local deafultCash = 0
local playersLeft = 0
game.Players.PlayerAdded:Connect(function(player)
playersLeft = playersLeft + 1
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new ("IntValue")
money.Name = "Money"
money.Value = 0
money.Parent = leaderstats
-- Data Stores
local player_data
pcall(function()
player_data = datastores:GetAsync(player.UserId.."-Money")
end)
if player_data ~= nil then
-- Player Has Saved Data
money.Value = player_data
else
--New Player
money.Value = deafultCash
end
end)
local bindabaleEvent = Instance.new("BindableEvent")
game.Players.PlayerRemoving:Connect(function(player)
pcall(function()
datastores:SetAysnc(player.UserId.."-Money",player.leaderstats.Money.Value)
print("Saved")
playersLeft = playersLeft - 1
bindabaleEvent:Fire()
end)
end)
game:BindToClose(function()
-- This Will be triggerd upon shutdown
while playersLeft > 0 do
bindabaleEvent.Event:Wait()
end
end)

4 comments
Do you have any places I should edit my script in?
It was that I misspelled Async in the one infront of playersLeft = playersLeft - 1
It has no errors but its still not saving the data!
local datastores = game:GetService("DataStoreService"):GetDataStore("MoneyDataStore") local deafultCash = 0 local playersLeft = 0 game.Players.PlayerAdded:Connect(function(player) playersLeft = playersLeft + 1 local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new ("IntValue") money.Name = "Money" money.Valu