Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

14:04:41.768 - Not running script because past shutdown deadline (x10) ?

Asked by
Nimbzee 14
4 years ago

I don't know what is the problem, but when I leave in-studio from playtesting solo, Studio freezes then after some seconds, it works fine again but an error pops up. 14:04:41.768 - Not running script because past shutdown deadline (x10)

I poked around and I think it has something to do with datastores, which I have in my game. here is the code:

local datastore = game:GetService("DataStoreService")
local data1 = datastore:GetDataStore("mymoneydata")

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local greenmoney = Instance.new("NumberValue", leaderstats)
greenmoney.Name = "green_paper"
greenmoney.Value = data1:GetAsync(player.UserId) or 0
data1:SetAsync(player.UserId, greenmoney.Value)

game.Players.PlayerRemoving:connect(function()
data1:SetAsync(player.UserId, greenmoney.Value) 
end)
end)

I don't know what this is or how to fix it, and its annoying. please help.

1 answer

Log in to vote
0
Answered by 4 years ago

Hi, I am not sure of my answer, but I think the problem is that when a script saves something to the datastore, we have to wait like 10 seconds to let the datastore save THEN we can save again. So at line 10, when the player enters the game, the script saves his stats, but if the player leaves the game JUST AFTER he joined, the datastore will no have time to save his stats again at line 13. What I suggest to do is to delete line 10, so that whenever the player leaves, the datastore will be ready to save:

local datastore = game:GetService("DataStoreService")
local data1 = datastore:GetDataStore("mymoneydata")

game.Players.PlayerAdded:connect(function(player)
    local leaderstats = Instance.new("Folder",player)
    leaderstats.Name = "leaderstats"
    local greenmoney = Instance.new("NumberValue", leaderstats)
    greenmoney.Name = "green_paper"
    greenmoney.Value = data1:GetAsync(player.UserId) or 0

    game.Players.PlayerRemoving:connect(function()
        data1:SetAsync(player.UserId, greenmoney.Value)
    end)
end)

Hope this helped!

Ad

Answer this question