Use data stores for code storage. See readme on setting up multiple systems
This commit is contained in:
parent
b542213b7d
commit
8ea54f4b8f
Binary file not shown.
|
@ -3,4 +3,9 @@
|
|||
## TODO
|
||||
- [ ] Make installation instructions
|
||||
- [ ] Alarm reporting Roblox-Side script
|
||||
- [ ] More detailed Readme
|
||||
- [ ] More detailed Readme
|
||||
- [X] Use datastores for code storage
|
||||
|
||||
## Having multiple separate systems
|
||||
To put it simply, you just need to set the `dataStoreKey` string to *anything you want*
|
||||
If you want systems to share codes, use the same dataStoreKey (This is not supported, and may cause issues.)
|
|
@ -1,9 +1,16 @@
|
|||
local DataStoreService = game:GetService("DataStoreService")
|
||||
local dataStore = DataStoreService:GetDataStore('securityCodes-' .. script.Parent.dataStoreKey.Value or "XP-99")
|
||||
|
||||
function setup(parentScript)
|
||||
-- dont touch
|
||||
version = "v1.0.1"
|
||||
version = "v1.2.0"
|
||||
|
||||
-- codes object, will be swapped for data store later
|
||||
codes = {"1234"}
|
||||
codes = dataStore:GetAsync("codes")
|
||||
if not codes then
|
||||
codes = {"1234"}
|
||||
dataStore:SetAsync("codes", codes)
|
||||
end
|
||||
|
||||
-- Make a settings object mapped to the values in parentScript.Parent.Settings
|
||||
settings = {}
|
||||
|
@ -343,6 +350,7 @@ delay
|
|||
return
|
||||
else
|
||||
codes[tonumber(uid)] = nil
|
||||
dataStore:SetAsync("codes", codes)
|
||||
ding(1)
|
||||
end
|
||||
deauth()
|
||||
|
@ -354,6 +362,7 @@ delay
|
|||
if newCode == newCodeVerify then
|
||||
if not table.find(codes, newCode) then
|
||||
codes[tonumber(uid)] = newCode
|
||||
dataStore:SetAsync("codes", codes)
|
||||
ding(1)
|
||||
else
|
||||
ding(4)
|
||||
|
@ -548,7 +557,7 @@ delay
|
|||
task.spawn(stateLoop)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function stateLoop()
|
||||
while true do
|
||||
script.Parent.armState.Value = armState
|
||||
|
|
Loading…
Reference in a new issue