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

Datastore problem? Value not allowed?

Asked by 9 years ago

[Edited]

local scriptService = game:GetService("ScriptContext")
local ds = game:GetService("DataStoreService")
local errorLogs = ds:GetOrderedDataStore("ErrorLogs")

local function errorDetected(message,trace,brokenScript)
    print("Error detected: "..tostring(message))
    local key = tostring(math.floor(os.time()))
    pcall(function() errorLogs:UpdateAsync(key, function() return {Script = brokenScript:GetFullName(),Error = message,Trace = trace} end) end)
end

game.Workspace.RemoteFunction.OnServerInvoke = function(...) errorDetected(select(2,...)) end
scriptService.Error:connect(errorDetected)

Look at dat efficiency :p

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

error is a built-in function that acts similar to print except also causing an error and stopping execution.

You cannot save functions in data stores.


Most likely you meant to use message instead.

0
I did notice this later on, my bad. And I replaced with message and it still didn't work, I'll edit now. ZirutoHellfire 10 — 9y
Ad

Answer this question