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

How Can I Reference Objects With A Randomly Generated Name?

Asked by
Hacreey 49
4 years ago

On the start of my game, a few "special" objects will have their name changed to a randomly generated key. To note, i'm just doing this to make it a little more time consuming to exploit key aspects of my game, I DO NOT think this will end exploiting once and for all.

Now my issue you may ask, is referencing that object from other scripts. I have no problem referencing the object from the script the name was changed in. However, I need help figuring out how I can correctly identify that object from other scripts throughout my game.

I KNOW it's possible to do this as i've seen people use this method in their games, I just can't figure out how they're referencing objects from many different scripts throughout the game.

0
Before the names of the objects are randomized add them to a table with their unrandomized name being the key and the value being a reference to the object. Then when you need that object simply access the table. oreoollie 649 — 4y
0
Before the names of the objects are randomized add them to a table with their unrandomized name being the key and the value being a reference to the object. Then when you need that object simply access the table. oreoollie 649 — 4y
0
Before the names of the objects are randomized add them to a table with their unrandomized name being the key and the value being a reference to the object. Then when you need that object simply access the table. oreoollie 649 — 4y

1 answer

Log in to vote
0
Answered by
KDarren12 705 Donator Moderation Voter
4 years ago
local a = math.random
local oof = {}
table.insert(a,oof)

they will be in order so you can grab them by number

0
it's not perfect but i'm exhausted and this isnt my best answer KDarren12 705 — 4y
0
The key name is actually a GUID, math.random is more likely to repeat numbers. Hacreey 49 — 4y
0
good to know KDarren12 705 — 4y
0
Random:NextInteger(0,9999999999999999) its over 9000? bhqpping 80 — 4y
Ad

Answer this question