Hello everyone!
So today I wanna present my model. System Chat Message!
About:
- This lets you create messages by doing /system [MESSAGE].
- Easy to setup
- You can change COLORS!
You can use the model here. This is still on beta, so if theres any errors/bugs you can report them here.
Commands:
- /system [MESSAGE]
Theres errors you can encounter. Such as Cannot use command '/system'. Expected 2nd arguement.
This happens if you dont have a message with /system.
Source Code:
Main Script
Info: This handles the Chat commands. Also sets the model up.
-- By funnfunns
-- Setup
if script.Parent:FindFirstChild('ThumbnailCamera') then
script.Parent.ThumbnailCamera:Destroy()
end
script:FindFirstChild('SystemClient').Parent = game:GetService('StarterGui')
script:FindFirstChild('SystemRemote').Parent = game:GetService('ReplicatedStorage')
script:FindFirstChild('ChatModules').Parent = game:GetService('Chat')
-- Variables
local player = game:GetService('Players')
local remoteEvent = game:GetService('ReplicatedStorage'):WaitForChild('SystemRemote')
local chat = game:GetService('Chat')
-- Main Script
player.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local splits = string.split(msg, ' ')
if splits[1]:lower() == '/system' then
if splits[2] == '' or splits[2] == nil then
return
end
remoteEvent:FireAllClients(chat:FilterStringForBroadcast(table.concat(splits, ' ', 2), plr), plr.Name)
end
end)
end)
Main Script (Client)
Info: This handles the messasge creator. You can change the message color.
warn('LocalScript')
local remoteEvent = game:GetService('ReplicatedStorage'):WaitForChild('SystemRemote')
remoteEvent.OnClientEvent:Connect(function(text, player)
wait(.1)
game:GetService('StarterGui'):SetCore('ChatMakeSystemMessage', {
Text = '['..player..']: '..text;
Font = Enum.Font.ArialBold;
Color = Color3.new(1, 1, 1); -- Color goes here.
FontSize = Enum.FontSize.Size96;
})
end)
ErrorHandler (Client)
Info: This handles errors such as Invalid argument 2.
-- This handles errors.
local error_cannot_use_command = 'Cannot use command \'/system\'. Expected 2nd arguement.'
game:GetService('Players').LocalPlayer.Chatted:Connect(function(msg)
if msg == '/system' then
wait(.1)
game:GetService('StarterGui'):SetCore('ChatMakeSystemMessage', {
Text = error_cannot_use_command;
Font = Enum.Font.ArialBold;
Color = Color3.new(1, 0.2, 0.2);
FontSize = Enum.FontSize.Size96;
})
end
end)
ChatModule (RadioChatBlock)
This makes it so the /system messages wont appear.
warn('radio chat block')
local function Run(ChatService)
local function processChat(speakerName, message, channelName)
local splits = string.split(message, ' ')
if splits[1] == '/system' then
return (true)
end
return (false)
end
ChatService:RegisterProcessCommandsFunction("RadioChatBlock", processChat)
end
return Run
Goodbye. If you have any questions about the srouce code, or bugs please leave theme in the replies. Also, thanks!!
Version 0.0