How to convert Instance to Hex

You know how you can print a function and it returns some gibberish in hex?

function test()
 print("e")
 print("1238")
end

print(test) -- function: <hex>

I’ve heard Instances can do the same. But how would I even do it and is there a way to get the Instance back from hex?

1 Like

Hello, maybe this will help?

1 Like

What’s this for exactly? I would steer away from doing something like this.

2 Likes

What you’re referring to is a hexadecimal memory address. It’s basically what’s stored internally and is unique for every instance.

There currently isn’t a way to get the hexadecimal address as it’s stored internally, but you are able to store the instance itself.

Here’s a theoretical example:

local Part1 = workspace.Part1 --> internally stored as "0xabcdef"
local Part2 = workspace.Part2 --> internally stored as "0x123456"
print(Part1) --> prints the part stored as "0xabcdef"
print(Part2) --> prints the part stored as "0x123456"
1 Like

I want to save the instance in a StringValue.

Why would you? I don’t see anything bad with it.

1 Like

This is for strings. It does not work for Instances.

1 Like

Ok, so is there a way to maybe encode an Instance into hex?
For example, we can do this with functions (I recommend checking out vLua). We convert them into hex and then execute them (not sure though).

1 Like

Oh so you are trying to convert string into code somewhat? I see now. Your best bet for short term is adding an Attribute to every instance that you would want to encode. You can do this by sorting them into a folder and doing some console commands, etc… You can also do this when the server instance begins via Server script.

Another way is justs sharing a Server-Client table containing all the IDs of the instances. You can also do this with console commands or at the start of a server instance.

Achieve this all with GUIDs.