Amazingranma261

chat

Jul 28th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. player = game.Players.amazingranma261
  2. mod = player.character
  3. head = mod.Head
  4. gui_height = 5
  5. max_distance = 60
  6. chat_active = false
  7.  
  8. function createChatBubble(seconds, message)
  9.     chat_active = true
  10.    
  11.     local gui = Instance.new("BillboardGui",head)
  12.         gui.Adornee = head
  13.         gui.MaxDistance = max_distance
  14.         gui.ExtentsOffsetWorldSpace = Vector3.new(0,gui_height,0)
  15.         gui.Size = UDim2.new(0.2,0,0.8,0)
  16.        
  17.     local chat_bubble = Instance.new("Frame",gui)
  18.         chat_bubble.Size = UDim2.new(1,0,1,0)
  19.         chat_bubble.BackgroundTransparency = 0.5
  20.         chat_bubble.BackgroundColor3 = Color3.new(0,0,0)
  21.        
  22.     local text_label = Instance.new("TextLabel",chat_bubble)
  23.         text_label.Size = UDim2.new(1,0,1,0)
  24.         text_label.TextColor3 = Color3.fromRGB(155,212,59)
  25.         text_label.TextSize = 20
  26.         text_label.Font = "Arcade"
  27.         text_label.BackgroundTransparency = 1
  28.         text_label.Text = ""
  29.        
  30.     for i = 1,string.len(message)+2 do
  31.         text_label.Text = string.sub(message,1,i)
  32.         gui.Size = gui.Size + UDim2.new(.2,0,0,0)
  33.         wait(.1)
  34.     end
  35.    
  36.     wait(seconds)
  37.    
  38.     gui:Destroy()
  39.     chat_active = false
  40. end
  41.  
  42. player.chatted:connect(function(msg)
  43.     if(not chat_active) then
  44.         createChatBubble(3,msg)
  45.     end
  46. end)
Advertisement
Add Comment
Please, Sign In to add comment