How did devs made this messages script but locally too? How to chabge color of this messages like it
they ve used something called string.format
This script will work for your needs.
1, Place the LocalScript in Starter Player>Starter Player Scripts. Make sure ChatService is LegacyChatService. Please revise to fit your needs.
local messages =
{
"Missing Permission",
"The Devforum is great!"
}
local timePerMessage = 10
while wait(timePerMessage) do
game.StarterGui:SetCore("ChatMakeSystemMessage",
{
Text = "[Command]: " .. messages[math.random(1, #messages)],
Color = Color3.fromRGB(255, 0, 0),
Font = Enum.Font.LuckiestGuy,
TextSize = 20,
})
end
This is already superseded with TextChannel:DisplaySystemMessage
.
What part of the script should I revise?
You shouldn’t be using setcore
at all you should be using TextChatService. I didn’t even notice but you use wait
instead of task.wait
? Switch that too
Got it, thanks for the help. I will let you know how it works.
Bro I just through the roblox documentation. StarterGUi:SetCore is not deprecated. Why do think I cannot use this function?
I never said it’s deprecated. Handling chat based things should be done with TextChatService
I’m new to scripting. What would be the issue with using my script? It works,
Thanks for your time!
There was a specific service “TextChatService” made for these type of things. Here’s a quick (and probably incorrect) example
local tcs = game:GetService('TextChatService')
local displayevent = game.ReplicatedStorage.DisplayEvent
tcs.CreateDefaultTextChannels = true
game.Players.PlayerAdded:Connect(function(plr)
displayevent:FireAllClients(plr.Name..' joined!')
end)
-- Local script
local tcs = game:GetService('TextChatService')
game.ReplicatedStorage.DisplayEvent.OnClientEvent:Connect(function(msg)
tcs.TextChannels.RBXGeneral:DisplaySystemMessage("<font color='rgb(255,0,0)'>"..msg.."</font>"
end)
Thanks Dr. Mystery, I will read the TextChatService docs to learn how to do it myself next time.