Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a .Chatted function say your text into a full message?

Asked by 9 years ago

Here's what I have??

function Message(msg)
    Player = script.Parent.Parent
    if Player.Name == "umeh" or Player.Name == "Player" then
    if msg == "Message"..Chat.. then
            Instance.new("Message", game.Workspace)
            game.Workspace.Message.Text = Chat  
        end 
    end  
end

Help not working!

0
I want it to say Message and all the other messages you were saying :/ Roblox_v10 33 — 9y
0
You need to explain what you want to do better. BlueTaslem 18071 — 9y
0
Like kohls admin :m {Text} Roblox_v10 33 — 9y

1 answer

Log in to vote
0
Answered by
Ryzox 220 Moderation Voter
9 years ago
Admins = {"umeh", "Player"} -- Admins

Player = script.Parent.Parent

function checkAdmin(plr) -- Checks admin
    for _,plrs in pairs(Admins) do
        if plrs:lower() == plr.Name:lower() then -- Checking if names in Admins table are equal to "plr"
            return true
        end
    end
end

Player.Chatted:connect(function(msg) -- Checks if Player chatted
    if checkAdmin(Player) then -- Checks if Player is an admin
        if msg:lower():sub(1,3) == ":m " then -- checks if the first 3 chars of the msg is ":m "
            local m = Instance.new("Message", workspace)
                m.Text = "["..Player.Name.."]: "..msg:sub(4) -- Should make the message say "[Player]: Text here"
            wait(2)
            m:Destroy() -- Removes message
        end
    end
end)

I edited it a little so that you can add player names easier to the script, look over the script and if you don't understand any of it please just ask.

Ad

Answer this question