Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screenGui = Instance.new("ScreenGui")
- local frame = Instance.new("Frame")
- local textLabel = Instance.new("TextLabel")
- local textBox = Instance.new("TextBox")
- local sendButton = Instance.new("TextButton")
- -- Set up the ScreenGui
- screenGui.Name = "MessageGUI"
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- -- Set up the Frame
- frame.Size = UDim2.new(0.4, 0, 0.3, 0)
- frame.Position = UDim2.new(0.3, 0, 0.35, 0)
- frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
- frame.Parent = screenGui
- -- Set up the TextLabel
- textLabel.Text = "Enter your message:"
- textLabel.Size = UDim2.new(1, 0, 0.3, 0)
- textLabel.Position = UDim2.new(0, 0, 0, 0)
- textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
- textLabel.TextColor3 = Color3.new(1, 1, 1)
- textLabel.TextScaled = true
- textLabel.Parent = frame
- -- Set up the TextBox
- textBox.PlaceholderText = "Type here..."
- textBox.Size = UDim2.new(0.9, 0, 0.3, 0)
- textBox.Position = UDim2.new(0.05, 0, 0.35, 0)
- textBox.BackgroundColor3 = Color3.new(1, 1, 1)
- textBox.TextColor3 = Color3.new(0, 0, 0)
- textBox.TextScaled = true
- textBox.Parent = frame
- -- Set up the TextButton
- sendButton.Text = "Send Message"
- sendButton.Size = UDim2.new(0.6, 0, 0.2, 0)
- sendButton.Position = UDim2.new(0.2, 0, 0.7, 0)
- sendButton.BackgroundColor3 = Color3.new(0.1, 0.6, 0.1)
- sendButton.TextColor3 = Color3.new(1, 1, 1)
- sendButton.TextScaled = true
- sendButton.Parent = frame
- -- Button click function
- sendButton.MouseButton1Click:connect(function()
- local messageText = textBox.Text
- if messageText and messageText ~= "" then
- local message = Instance.new("Message")
- message.Text = messageText
- message.Parent = workspace
- wait(5)
- message:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement