How can you turn a String into Binary?

Ive look around but found nothing or stuff that would not work.
So how can you turn a string like “Hello!” into binary and would i turn it back into a string?

1 Like

Do you mean converting each character in a string to ASCII and represent ASCII code in base 2 system?

yea they mean that
that’s how text to any base number system works

convert to ASCII and then convert to the base you want

I made this:

local text = "Brick"
local splittedText = text:split("")
local textInBinary = {}
for i, v in pairs(splittedText) do
local byte, binaryNumber = v:byte(), ""
while byte > 0 do
binaryNumber = tostring(byte % 2) .. binaryNumber
byte = math.modf(byte / 2)
table.insert(textInBinary, string.format("%.8d", binaryNumber))

This is not 100% my brainpower, this exact reply from an another post helped me do this:
Binary Encode/Decode? - Help and Feedback / Scripting Support - DevForum | Roblox

1 Like

Why do you need to do this in the first place? It seems like a weird thing to want to do.