Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bits = 8 -- minimum 8 bits for all string characters to load
- local starting_char = 0 -- 97 for only letters, 0 for all characters
- local reserve = bits
- function get_size(n)
- local kb = 1000
- local mb = kb*1000
- local gb = mb*1000
- local tb = gb*1000
- local t = ''
- local c = false
- if n >= tb then
- repeat
- n = n/tb;
- t = 'tb';
- until tb > n
- elseif n >= gb then
- repeat
- n = n/gb;
- t = 'gb';
- until gb > n
- elseif n >= mb then
- repeat
- n = n/mb;
- t = 'mb';
- until mb > n
- elseif n >= kb then
- repeat
- n = n/kb;
- t = 'kb';
- until kb > n
- else
- c = true
- t = 'byte'
- end
- if not c then
- n = n-(n%0.01)
- end
- t = tostring(n) .. ' ' .. t
- return t
- end
- function make_byte(char)
- local byte = {}
- local indentity = string.byte(char)-starting_char
- --print(indentity)
- for i = 1,reserve,1 do
- local p = 2^(reserve-i)
- local r = 0
- if indentity >= p then
- indentity -= p
- r += 1
- end
- byte[2^(reserve-i)] = r
- end
- return byte
- end
- function convert_string_to_bytes(str)
- local _time = tick()
- local bytes = {}
- local s = ''
- for i = 1, string.len(str) do
- bytes[i] = make_byte(string.sub(str,i,i))
- for bit = #bytes[i],1,-1 do
- if bytes[i][bit] then
- s = s .. bytes[i][bit]
- end
- end
- s = s .. ' '
- end
- return bytes,_time,s
- end
- function convert_bytes_to_string(bytes,_time)
- local s = ''
- for i = 1,#bytes do
- local n = 0
- for place,bit in pairs(bytes[i]) do
- local p = 2^(reserve)
- if bytes[i][place] >= 1 then
- n += place
- end
- end
- n = n+starting_char
- s = s .. string.char(n)
- end
- return bytes,s,tick()-_time
- end
- local char = owner.Character
- local head = char['Head']
- BillboardGui0 = Instance.new("BillboardGui")
- TextBox1 = Instance.new("TextBox")
- BillboardGui0.Parent = head
- BillboardGui0.LightInfluence = 1
- BillboardGui0.Size = UDim2.new(8, 0, 3, 0)
- BillboardGui0.Active = true
- BillboardGui0.ClipsDescendants = true
- BillboardGui0.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- BillboardGui0.SizeOffset = Vector2.new(0, 2)
- TextBox1.Parent = BillboardGui0
- TextBox1.Size = UDim2.new(1, 0, 1, 0)
- TextBox1.BackgroundColor = BrickColor.new("Institutional white")
- TextBox1.BackgroundColor3 = Color3.new(1, 1, 1)
- TextBox1.BackgroundTransparency = 1
- TextBox1.Font = Enum.Font.SourceSans
- TextBox1.FontSize = Enum.FontSize.Size14
- TextBox1.TextColor = BrickColor.new("Institutional white")
- TextBox1.TextColor3 = Color3.new(1, 1, 1)
- TextBox1.TextScaled = true
- TextBox1.TextSize = 14
- TextBox1.TextStrokeTransparency = 0
- TextBox1.TextWrap = true
- TextBox1.TextWrapped = true
- function changetxt(str)
- local c = {convert_string_to_bytes(str)}
- local bytes,str2,_time = convert_bytes_to_string(unpack(c))
- TextBox1.Text = 'co: ' .. c[3] .. '\n de: ' .. str2 .. '\n bytes: ' .. get_size(table.getn(bytes)) .. '\n time: ' .. _time-(_time%0.001)
- end
- owner.Chatted:Connect(function(msg)
- if msg:lower():sub(1,4) == 'con/' then
- local str = msg:sub(5)
- if str then
- changetxt(str)
- end
- elseif msg:lower():sub(1,7) == '/e con/' then
- local str = msg:sub(8)
- if str then
- changetxt(str)
- end
- elseif msg:lower():sub(1,5) == 'crep/' then
- local str = msg:sub(6)
- if str then
- changetxt(string.rep(str,100))
- end
- elseif msg:lower():sub(1,8) == '/e crep/' then
- local str = msg:sub(9)
- if str then
- changetxt(string.rep(str,100))
- end
- end
- end)
Add Comment
Please, Sign In to add comment