Quick actions

cmd+k|ctrl+k

Navigation

Languages

chat

Snippet info

Language

Lua

Visibility

public

Author

ahem-what-s-this

Created

2019-09-20T21:02:54Z

Updated

2019-09-21T11:18:29Z

players = game:GetService("Players")
player = owner
head = player.Character:WaitForChild("Head")
max_distance = 60
chat_bubbles = 0
gui_height = 5
bubble_color = Color3.fromRGB(255,255,255)
chat_color = Color3.fromRGB(0, 0, 255)

function createChatBubble(seconds, message)
  chat_bubbles = chat_bubbles + 1
    local gui = Instance.new("BillboardGui",head)
        gui.Adornee = head
        gui.MaxDistance = max_distance
        gui.ExtentsOffsetWorldSpace = Vector3.new(0,gui_height+(chat_bubbles*1.5),0)
        gui.Size = UDim2.new(0,32*(#message/3),0.6,0)

    local chat_bubble = Instance.new("Frame",gui)
        chat_bubble.Size = UDim2.new(1,0,1,0)
        chat_bubble.BackgroundTransparency = 0
        chat_bubble.BackgroundColor3 = bubble_color


    local text_label = Instance.new("TextBox",chat_bubble)
    text_label.Text = message
    text_label.Size = UDim2.new(1,0,1,0)
    text_label.TextColor3 = chat_color
    text_label.TextSize = 20
    text_label.Font = "Cartoon"
    text_label.BackgroundTransparency = 1
    wait(seconds)
    gui:Destroy()
  chat_bubbles = chat_bubbles - 1
end

player.chatted:connect(function(msg)
        chat = coroutine.wrap(createChatBubble)
    chat((#msg/5)+2,msg)
end)
INFO