Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __AUTHOR__ = "Guest537561"
- local PLAYER = owner
- local CHARACTER = owner.Character
- local HEAD = CHARACTER:WaitForChild("Head")
- local MAX_VIEW_DISTANCE = 30
- local GUI_HEIGHT = 5
- local CHAT_BACKGROUND_COLOR = Color3.fromRGB(0,0,0)
- local CHAT_BACKGROUND_TRANSPARENCY = 1
- local CHAT_FONT = 1
- local chatGUIs = {}
- local s = Instance.new("Sound", HEAD)
- s.SoundId = "rbxassetid://418252437"
- s.Volume = 9e9
- s.Pitch = 1
- function updateChatPosition()
- for i, v in pairs(chatGUIs) do
- v.ExtentsOffsetWorldSpace = v.ExtentsOffsetWorldSpace + Vector3.new(0,1.5,0)
- end
- end
- function createChatBubble(seconds, message)
- assert(type(CHAT_FONT) == "number" and CHAT_FONT <17 and CHAT_FONT > -1, "Invalid font value, please enter a number between 0 and 16")
- updateChatPosition()
- local CHAT_GUI = Instance.new("BillboardGui",HEAD)
- CHAT_GUI.Adornee = CHAT_GUI.Parent
- CHAT_GUI.MaxDistance = MAX_VIEW_DISTANCE
- CHAT_GUI.ExtentsOffsetWorldSpace = Vector3.new(0,GUI_HEIGHT,0)
- CHAT_GUI.Size = UDim2.new(0,36*(#message/3),0.6,0)
- table.insert(chatGUIs, CHAT_GUI)
- local CHAT_FRAME = Instance.new("Frame",CHAT_GUI)
- CHAT_FRAME.Size = UDim2.new(1,0,1,0)
- CHAT_FRAME.BackgroundTransparency = CHAT_BACKGROUND_TRANSPARENCY
- CHAT_FRAME.BackgroundColor3 = CHAT_BACKGROUND_COLOR
- local CHAT_TEXT = Instance.new("TextBox",CHAT_FRAME)
- CHAT_TEXT.Size = UDim2.new(1,0,1,0)
- CHAT_TEXT.TextColor3 = Color3.new(1,1,1)
- CHAT_TEXT.TextSize = 20
- CHAT_TEXT.MultiLine = true
- CHAT_TEXT.Font = CHAT_FONT
- CHAT_TEXT.BackgroundTransparency = 1
- for i = 1,#message do
- CHAT_TEXT.Text = string.sub(message,1,i)
- s:Play()
- wait()
- end
- wait(seconds)
- table.remove(chatGUIs, 0)
- CHAT_GUI:Destroy()
- updateChatPosition()
- end
- PLAYER.Chatted:connect(function(msg) coroutine.wrap(createChatBubble)((#msg/5)+2,msg) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement