Need help with chat system things

So I am making a game for entertainment purposes only. In this game, whenever you chat, the server will spam the message over and over again.

I have two “problems” in the chat:

  1. I want to make the chat color whatever the player’s name color is
  2. I also want to make the name color and the chat color different

So if these two problems can be solved, the result would basically mimic the player.Screen Shot 2020-06-18 at 9.50.54 AM (Note: This is me talking, not the server)

If I cannot do this, please let me know!

https://developer.roblox.com/en-us/articles/Lua-Chat-System/API/ChatSpeaker
https://prnt.sc/t23wf5

1 Like

This is not what I want. :expressionless:

I do not want to set extra data, and if I did, I would not have come here (already have like a lot of experience).

Let me explain it more clearly.
IAmPinleon Picture
In the white, the player (me). I want to get the name color FOR THAT, not using :SetExtraData().
In the red, the message. I want to get the chat color FOR THAT, not using :SetExtraData().

1 Like

https://prnt.sc/t2416q
You can then use GetExtraData for the name color, which is the first thing you wanted.

Eventually, you could check out a post that gets the color based on the length of the player’s username.
Click here.

1 Like

This didn’t work. The output shows:

yay
nil

when I did this:

local players = game:GetService("Players")
local server = game:GetService("ServerScriptService")

repeat wait() until server.ChatServiceRunner
local chatService = require(server.ChatServiceRunner.ChatService)

chatService.SpeakerAdded:Connect(function(User)
	local speaker = chatService:GetSpeaker(User)
	local plr = players[User]
	
	local data
	local success, err = pcall(function()
		data = speaker:GetExtraData("NameColor")
	end)
	
	if not success and not data then
		warn(err)
		--print(tostring(data))
	else
		print('yay')
		print(tostring(data))
	end
end)
1 Like

You have to use SetExtraData in order to use GetExtraData.
And please get rid of that repeat loop, it’s not needed.
You don’t need pcall either.

https://prnt.sc/t25s29

You can do this instead, and then GetExtraData after you’ve set it.

local ScriptService = game:GetService('ServerScriptService')
local ChatService = require(ScriptService.ChatServiceRunner.ChatService)

ChatService.SpeakerAdded:Connect(function(SpeakerName)
	local Speaker = ChatService:GetSpeaker(SpeakerName)
    Speaker:SetExtraData('NameColor', BrickColor.new('Lime green').Color)
	Speaker:SetExtraData('ChatColor', BrickColor.new('Really red').Color)
end)
1 Like

I don’t want to use :SetExtraData() though -_-

I plan on not using :SetExtraData() unless it is the only option.

I thought you wanted to?
As you said earlier: I also want to make the name color and the chat color different

And, I also sent you this earlier if you wanted to get the color based on the username length:
https://www.reddit.com/r/roblox/comments/4qdckg/how_to_successfully_predict_name_change_colors