#How do i make a script where it puts messages in chat with custom colors?

1 messages · Page 1 of 1 (latest)

scarlet bison
#

module script set up:

local WarnChat = {}

function WarnChat.Trigger()
    
end
return WarnChat
silver barn
#

bro

#

before asking on here search on google

azure sonnet
#

StarterGui:SetCore()

scarlet bison
silver barn
#

it dosent need to be

#

it wastes time of other people if there is an easy answer on google

scarlet bison
#
local WarnChat = {}

function WarnChat.Trigger()
    game.TextChatService.TextChannels.RBXGeneral:DisplayServerMessage("Hide..")
end

return WarnChat
#

i put code from youtube tutorial but doesnt work

#

bruh i even changed DisplaySeverMessage to DisplaySystemMessage and the output shows this:

silver barn
#

you have to do it on a local script

scarlet bison
#

oh wait i can code module script to enable the local one

silver barn
#

yeah

#

well

scarlet bison
#

but i have a problem, when the local script got activated

silver barn
#

clone the local script into every player

scarlet bison
#

Adinos admin gave me urgent message

silver barn
#

so it shows for all players

silver barn
#

whats the messahe

scarlet bison
#

and "Hide.." in chat didnt pop up

silver barn
#

lemme do some research

scarlet bison
#

as soon as the local script got acivated

#

what if i try to do the player gui instead of screengui

silver barn
#

what does it say

scarlet bison
#

just some announcement that i dont even know what it even says

silver barn
#

my studio just crashed

#

click it

#

its probably some message or issue with it

#

dw abt it

scarlet bison
silver barn
#

oh

#

so there is a vulnerability

#

i wouldnt worry unless you have a playerbase over 10

silver barn
#

with gui

#

u can also use remote events like this guy

scarlet bison
#
local WarnChat = {}

local Players = game:GetService("Players")
local PlayerGui = game:GetService("PlayerGui")
function WarnChat.Trigger()
    for _, player in Players:GetPlayers() do
        PlayerGui.WarnChat.Enabled = true
    end
end

return WarnChat
#

i dont even know why enabling a local script gives error

#

oh wait forgot to put player.

silver barn
#

read what the error says

#

if something is "index nil" then that means it dosent exist

scarlet bison
#

code works now, but how do i make it custom color. wait lemme see if the tutorial guy mentioned about custom colors

#

btw will my table function code work?

wait(1)

local warnMsgTABLE = {
    "Hide..",
    "Run Away",
    "He is coming"
}
local warnMsgCount = #warnMsgTABLE
local warnMsg = math.random(1, warnMsgCount)
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(`<font color=#FF0000>{warnMsg}`)
#

wait afk for 5 or 10 mins

scarlet bison
#

back

#

lemme see if my code works or not

#
wait(1)

local warnMsgTABLE = {
    "Hide..",
    "Run Away",
    "He is coming"
}
local warnMsg = Random(warnMsgTABLE)
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(`<font color=#FF0000>{warnMsg}</font>`)

fixed code

#

@silver barn any idea on how to fix this? btw i also used table instead of Random but it gave out same error

silver barn
#

sorry i didnt respond

scarlet bison
#

its okay

silver barn
#

thats not how random works i think

#

wait a sec

#

use

scarlet bison
#

ok

#

okay it worked but how didnt that html work??

#

it was supposed to say "Hide.." in color red

#

i used the code thats identical to the tutorial video but it worked for him and not me

#

look at his video

silver barn
#

v=

#

game.TextChatService.TextChannels.RBXSystem:DisplaySystemMessage("<font color="rgb(255, 0, 0)">Hello world!</font> ")

#

copy and paste this

scarlet bison
#

ok

#

oh wait it turned out that i forgot to put this symbol ` between the #FF0000

#

i mean this symbol '

#
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(`<font color='#FF0000'>{warnMsg}</font>`)
#

for some reason discord doesnt mark it as lua coding language bruh