How to make a GUI on top of screen when u say -m text?

local MessageGUI = Instance.new("TextLabel")
MessageGUI.Size = UDim2.new(1, 0, 0, 50)
MessageGUI.Position = UDim2.new(0, 0, 0, -50)
MessageGUI.BackgroundTransparency = 1
MessageGUI.Font = Enum.Font.SourceSansBold
MessageGUI.FontSize = Enum.FontSize.Size18
MessageGUI.TextColor3 = Color3.new(1, 1, 1)
MessageGUI.TextStrokeTransparency = 0.5
MessageGUI.TextStrokeColor3 = Color3.new(0, 0, 0)
MessageGUI.Parent = game.Players.LocalPlayer.PlayerGui

local function showMessageGUI(message)
    MessageGUI.Text = message
    MessageGUI.Visible = true
    wait(10)
    MessageGUI.Visible = false
end

game.Players.LocalPlayer.Chatted:Connect(function(message)
    if string.sub(message, 1, 2) == "-m" then
        local Msg = string.sub(message, 4) -- Extracts the message after "-m"
        showMessageGUI(Msg)
    end
end)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.