Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I get chat messages to pop up randomly?

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

3 comments

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

0

You are trying to make scam? Aren't you?

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

1 answer

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! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.