if you want it to perm prevent from getting the same string then here
local HttpService = game:GetService("HttpService")
local result1 = HttpService:GenerateGUID(true)
local result2
repeat wait() result2 = HttpService:GenerateGUID(true) until result2 ~= result1
if result2 ~= result1 then
-- code
end
You will legit never have to worry about them being the same because you are more likely to be hit by a metor than having two guids being the same. you do not have to implement code to insure that they are different.
noo bro this is like a 0.0000000001% chance bro if you spend a year generating 1000 guids a millisecond u will most likely not see one guid that is the same
There are 32 hex digits in a GUID, that is a 1 in 340282366920938463463374607431768211456 chance of a collision, which means for all intents and purposes, it will not happen
I am not sure that you understand probability. In the event that two GUIDs are the same roblox should be the least of your concerns, since you are now the luckiest human to ever exist. ever.
Let me clarify a bit more, I am trying to make a global shop and when a player sells an item, it will send to all server a UID, so the 1 in 103 trillion chance is more likely to occur
It is much more likely that a gamma ray burst obliterates life on Earth this instant than it is to generate a duplicate UID.
Just look at Youtube video IDs, it has far less characters (11), wouldn’t you think that if this was such a big concern companies that big would be a little bit more worrying?
It’s not concerning at all, the numbers are just too big for you to understand the unlikeliness of such an event, especially considering that we’re not talking about the generation of an equal UID in the entirety of Roblox, just exclusively to your game.
No worries, here’s some very dumbed down math that might help you get a glimpse of the problem.
A UID is a 32 character string consisting of both numbers and letters. There are 10 available numbers (including 0) for each slot and 26 available letters, if you count uppercase, that’s 52 available letters.
If you have a full-number UID, that would be:
1 in 10^32 chance 100.000.000.000.000.000.000.000.000.000.000
If you have a full-letter UID, that would be:
1 in roughly 8,16e+54 chance 81678357600369144882544181084627000000000000000000000000000000000000000000000000000000
These numbers might help you understand a little bit better of the magnitude we are talking about.
I thought these GUIDs were represented by hex digits, so wouldn’t it only be 16 characters? (The end result is pretty much the same – a very low chance)