Compact UID Module

Hello DevForum!

(This is my first resource)

I thought that using HttpService:GenerateGUID(true) costs to much data on a large scale and it isn’t a “real” unique identifier.

Thats why I desided to create an algorithm that counts characters like numbers, so it costs way less data and its a real unique identifier!

Methods:

  • UIDModule:createUID(class)

Code example:

local replicatedStorage = game:GetService("ReplicatedStorage")

local modules = replicatedStorage:WaitForChild("modules")
local UIDModule = require(modules:WaitForChild("UIDModule"))

local UIDAmount = 10000
local className = "test"

local UIDS = {}
local totalUIDString = ""

for i = 1, UIDAmount do
local UID = UIDModule:createUID(className)
table.insert(UIDS, UID)
totalUIDString = totalUIDString .. UID
end

(sorry for no indents, on mobile)

Pictures/ Videos:


Here is the module:
UIDModule.lua.txt (1.9 KB)

You can change the characters you want to use by removing or adding the for loops at the beginning and adding more tables.

Rate?

  • 10
  • 9
  • 8
  • 7
  • 6
  • 5
  • 4
  • 3
  • 2
  • 1
0 voters

Would you use this?

  • Yes
  • Yes, but not right now
  • No
0 voters

And please tell me below what I can do to improve this resource or my post next time.

Have a good day!

@qipaoist, what would you improve?

C++ native functions are better most of the time. What makes you think that? Do you have proof?

I think they’re saying that GenerateGUID isn’t a real unique identifier generator, I’ve heard that most GUID (including those outside roblox) can still collide with another GUID, just that it’s very unlikely

Yes thats true, but they are sooo long. This normally wouldn’t be a problem, but i am working on a recordingModule with tweenService, so I need to now wich part is linked to wich dictionaryKey. And since I am also datastoring this, it costs way less data to use this (3 bytes max) than GUID (always 16 bytes).

Summary: this costs less data then GUID.