ChatScript in Studio Test has a 50% change to work

Just noticed that this is also happening to me! How weird…

1 Like

Chat message.extraData seems to work fine for me in-game, I’ll update this post to see if I’m also having issues with extraData in studio…

Simply, Roblox needs to have the client WAIT for the server to be finished executing all game scripts for at least 1 second for a real world example. It makes no sense to have to wrap scripts for edge cases in which a player joined a server faster than the server script even loaded.

Yes, that t is from SimpleAdmin. It is fixed in the next SimpleAdmin update.

That’s because you don’t have any scripts waiting for a chat script. For example, Topbar v2 does.

1 Like

I meant Speaker:SetExtraData, that might be the same thing but I’m not able to get it to work haha.

That’s exactly what I mean and am using also.

It seems to still work for me? I’ll keep trying.

1 Like

I’ll try again, might have been something I did.

Edit: Yeah, same thing seems to happen. It waits around 1.5s for the chat to pop up, then when it finally does pop up, no chat tags. Do you think it could be because I’m calling :SetExtraData before the chat pops up?

Here’s my script:

local function setChatData(player, rankInfo) -- Player is the player instance and rankInfo is a table
--[[
Information inside of rankInfo: which is returned from a module outside of the script
		['Text'] = 'Some rank name';
		['CreateOverhead'] = true;
		['OverrideExtraData'] = true;
		['ChatInfo'] = {
			['GiveChatTag'] = true;
			['NameColour'] = Color3.fromRGB(245, 240, 142);
			['ChatColour'] = Color3.fromRGB(245, 243, 197);
		};

]]
	print('setextradata') -- Printing so it definitely is being called.
	
	local speaker = chatService:GetSpeaker(player.Name) or chatService:AddSpeaker(player.Name)
	if rankInfo.OverrideExtraData then
		print('oed') -- Printing
		if rankInfo.ChatInfo.GiveChatTag then
			print('gct') -- Printing
			speaker:SetExtraData('Tags', {
				{
					TagText = rankInfo.Text;
					TagColor = rankInfo.ChatInfo.NameColour or Color3.new(1,1,1);
				}
			})
		end
		speaker:SetExtraData('NameColor', rankInfo.ChatInfo.NameColour or Color3.new(1,1,1))
		speaker:SetExtraData('ChatColor', rankInfo.ChatInfo.ChatColour or Color3.new(1,1,1))
	else
		local playerNameColour = nameColour:GetNameColour(player.Name)

		local h, s, v = Color3.toHSV(playerNameColour)
		local newChatColour = Color3.fromHSV(h, s - (s * 0.8), v)

		print(newChatColour)

		speaker:SetExtraData('ChatColor', newChatColour)
	end
end