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

How would I get chat messages to pop up randomly?

Asked by 7 years ago

I'd like multiple messages to pop up randomly on the roblox chat GUI not sure how to do this can anyone help?

0
Since link answers aren't allowed. Here's something for you to light read. http://wiki.roblox.com/index.php?title=API:Class/Chat/Chat httpOmqCxpcake 70 — 7y
0
You are trying to make scam? Aren't you? Smore_Kettle 0 — 7y
0
@Smore_Ketle why would you assume something like that? @Unknown_Species this is related to your topic: http://wiki.roblox.com/index.php?title=API:Class/StarterGui/SetCore M39a9am3R 3210 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Resource(s) Used In My Answer: SetCore - Roblox Wiki

Answer to Your Question: You're going to want to start by creating a localscript inside of StarterPack. This is how we can access SetCore, which is part of the StarterGui. Here's your script:

math.randomseed(tick()*wait()) -- This ensures random numbers, and is used for math.random() later on.
local messagesToDisplay = { -- Inserts messages into here
    "[GAME]: Remember to thumbs up the game!",
    "[GAME]: Remember to favorite the game!"
};

local minTimeToWait = 60 -- What's the minimum wait time?
local maxTimeToWait = 300 -- What's the maximum wait time?

while wait(math.random(minTimeToWait, maxTimeToWait)) do
    local randomText = messagesToDisplay[math.random(1,#messagesToDisplay)] -- We'll get a random number between 1 and the total of all messages in the table and use that to find a random message.
        game.StarterGui:SetCore("ChatMakeSystemMessage", {
            Text = "randomText!"; -- Required. Has to be a string!
            Color = Color3.new(0, 1, 1); -- Cyan is (0, 255 / 255, 255 / 255). Optional, defaults to white: Color3.new(255 / 255, 255 / 255, 243 / 255)
            Font = Enum.Font.SourceSans; -- Optional, defaults to Enum.Font.SourceSansBold
            FontSize = Enum.FontSize.Size24; -- Optional, defaults to Enum.FontSize.Size18
        })
    end
end

Conclusion: Using math.random(), SetCore, and other important Lua/RBXLua features you can create a script that will randomly put out a message to the player every 60 - 300 seconds (obviously the numbers can be changed). I hope I helped you! :)

Ad

Answer this question