How would I run a string of code in the game if a user chats exactly this,
/m Server Hello!
This is a rough example.
Example
When a player says this \m Server Hello!
It would run this code
workspace.Chat:FireServer("PushChat","[Server]","Hello!")
That code would add a new line to the chat(I already know how to do this) and it would say this in the chat.
[Server]: Hello!
Notice how in that chat line it has 3 specific objects
/m -- Runs the Command
Server --The ChatType
Hello! --The Message
Those would correspond to this.
workspace.Chat:FireServer("PushChat","[ChatType]","Message")
Most games like OzzyPig or SmoothBlockModel use a GUI as a chat that uses textlabels, and we both know that you can edit text with everybody as a example
game.Player.PlayerAdded:connect(function(plr) if plr.Name == "Shedletsky" then for i,v in pairs (game.Players:GetPlayers()) do z = Instance.new("TextLabel") z.Parent = v:WaitForDataReady("ScreenGui").Frame z.Text = "[Server]".."Shedlestky has joined the server!" -- Not full thing like how to get them not to collide just the idea end end end)
This would be way more efficient since doing chat with workspace would not work not that I know of since I check methods that it leads to and also roblox chat is a CoreGui so I don't think doing it with workspace will effect player chat.
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) if string.sub(msg,1,7):lower() == "\m Server " then workspace.Chat:FireServer("PushChat","[Server]",string.sub(msg,8)) end end) end)