Hello! Welcome back to another tutorial Today we will be making a System Chat Message that chooses a random message.
Lets Get Started.
First, Off we need to Make a Local Script and Make sure to set its parent as ScreenGui.
Name the Local Script “Main” and Make a Module script as the Child and Name that “Messages”
For The Module script you Just want to enter the tags you want to show up.
Here is an Example:
local module = {
"{System}: Enjoying game? Why not make the Experience better by buying gamepasses";
"{System}: Don't Forget to tell all your friends about this game",
"{System}: Enjoying the game? Be sure to like, favourite, and follow to be updated when were updated",
-- Example Chat Messages
}
return module
Next, Thing We need to define this module in our Local script to do that we have to require it.
local messageModule = require(script:WaitForChild("Messages"))
Now, We want to make it loop so it displays more than 1 chat message to do that we will use a while loop.
local messageModule = require(script:WaitForChild("Messages"))
while true do
end -- ends while loop
For the game to choose a random Message we will need to use math.random to pick one out of absolute random
local messageModule = require(script:WaitForChild("Messages"))
while true do
local randomMessage = messageModule[math.random(1, #messageModule)] -- # means how many there are so we currently have 3
end
Now Finally we want to make it print out the message in the chat and also appear in chat after a certain amount of seconds
local messageModule = require(script:WaitForChild("Messages"))
while true do
local randomMessage = messageModule[math.random(1, #messageModule)]
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
Text = randomMessage;
Color = Color3.fromRGB(255,0,0); -- These Colours are In RGB or Color3 Change it to what you want this Colour is Really red
})
wait(50)-- Amount of time until the random Message Shows Up -- Also so game dosent crash/lag -- Change it to what you want
end
There we go It should be working
Please Like this tutorial if we get a lot of likes I might make a tutorial video sires
Test Game : Chat Message Test Place - Roblox
Please Comment any questions or Concerns
Update: I Now Have A Youtube Channel I may make a tutorial of this going more in deep click here to subscribe