|
| 23 Jul 2014 01:03 AM |
This script is giving every user the exact same serial number every time. I've changed the name of the DataStore several times already, and it gives one person a random serial then everyone else has the same serial as that first person.
local DataStore = game:GetService("DataStoreService"):GetDataStore("UserSerials") local Utils = assert(LoadLibrary("RbxUtility")) blank ={} function script.Parent.OnServerInvoke(playername) pastSN = DataStore:GetAsync("usr_"..playername.Name) or "blank" print(pastSN) if pastSN == "blank" then letters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} first = math.random(1,9) second = letters[math.random(#letters)] third = math.random(1,9) fourth = math.random(1,9) fifth = letters[math.random(#letters)] sixth = math.random(1,9) seventh = letters[math.random(#letters)] eighth = math.random(1,9) ninth = math.random(1,9) tenth = letters[math.random(#letters)] SN = "SN_"..first..second..third..fourth..fifth..sixth..seventh..eighth..ninth..tenth.."" print(SN) --[[DataStore:UpdateAsync("base", function(oldValue) local newValue = oldValue or Utils.EncodeJSON(blank) --oldValue might be nil newValue = Utils.DecodeJSON(newValue) table.insert(newValue,SN) table.insert(newValue,player) newValue = Utils.EncodeJSON(newValue) return newValue end)]]-- DataStore:SetAsync("usr_"..playername.Name,SN) return SN else return pastSN end end |
|
|
| Report Abuse |
|
|
| 23 Jul 2014 01:04 AM |
Put this at the top
math.randomseed(tick()) |
|
|
| Report Abuse |
|
| |