Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LocalScript inside StarterGui
- local Player = game.Players.LocalPlayer
- local ScreenGui = Instance.new("ScreenGui", Player:WaitForChild("PlayerGui"))
- local ChatFrame = Instance.new("Frame", ScreenGui)
- local ChatBox = Instance.new("TextBox", ChatFrame)
- -- Setup
- ScreenGui.Name = "CustomChat"
- ChatFrame.Position = UDim2.new(0.1, 0, 0.8, 0)
- ChatFrame.Size = UDim2.new(0.8, 0, 0.1, 0)
- ChatFrame.BackgroundColor3 = Color3.fromRGB(30,30,30)
- ChatFrame.BorderSizePixel = 0
- ChatBox.Size = UDim2.new(1, 0, 1, 0)
- ChatBox.BackgroundColor3 = Color3.fromRGB(20,20,20)
- ChatBox.TextColor3 = Color3.fromRGB(255,255,255)
- ChatBox.Font = Enum.Font.Code
- ChatBox.TextSize = 18
- ChatBox.PlaceholderText = "Type your message..."
- ChatBox.ClearTextOnFocus = true
- ChatBox.FocusLost:Connect(function(enterPressed)
- if enterPressed and ChatBox.Text ~= "" then
- local message = ChatBox.Text
- ChatBox.Text = ""
- -- Create on-screen "chat bubble"
- local bubble = Instance.new("TextLabel", ScreenGui)
- bubble.Text = message
- bubble.TextColor3 = Color3.new(1,1,1)
- bubble.Font = Enum.Font.SourceSansBold
- bubble.TextSize = 24
- bubble.Position = UDim2.new(0.5, -100, 0.75, -50)
- bubble.Size = UDim2.new(0, 200, 0, 50)
- bubble.BackgroundTransparency = 1
- -- Fade out
- game:GetService("TweenService"):Create(bubble, TweenInfo.new(2), {TextTransparency = 1}):Play()
- wait(2.5)
- bubble:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement