Global/Server Message

Hey, I’m trying to make a a global/server message when someone rolls a rare aura. The system works with no errors but it is not what I wanted.

message:
<font color=“d4d4d4”(><font color=‘#A020F0’(>[GLOBAL]: GeneralBadNews had rolled Basic (1 in 2)</fonts(></font(>
ignore the parenthesis they are not part of the issue

local color = DetermineColor(selectedAura)
		
		if selectedAura.Chance >= isOnBlackFrame then
			local message = string.format("[GLOBAL]: %s has rolled %s (1 in %s)", player.Name, selectedAura.Name, tostring(selectedAura.Chance))
			ReplicatedStorage.Remotes.Messages.Global:FireAllClients(message, color)
		else
			local message = string.format("[SERVER]: %s has rolled %s (1 in %s)", player.Name, selectedAura.Name, tostring(selectedAura.Chance))
			ReplicatedStorage.Remotes.Messages.Server:FireAllClients(message, color)
		end
local function DetermineColor(color)
	warn(color)
	
	if color then
		local r, g, b = color.R * 255, color.G * 255, color.B * 255
		print(r,g,b)
		
		local hexColor = string.format("#%02X%02X%02X", r, g, b)
		warn(hexColor)
		
		return hexColor
	else
		return "#FFFFFF"
	end
end

local function DisplayServerMessage(message, color)
	local colorHex = DetermineColor(color)
	local prefix = "<font color='"..colorHex.."'>"
	local formattedMessage = prefix .. message .. "</fonts>"
	
	TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXGeneral"):DisplaySystemMessage(formattedMessage)
end

local function DisplayGlobalMessage(message, color)
	local colorHex = DetermineColor(color)
	local prefix = "<font color='"..colorHex.."'>"
	local formattedMessage = prefix .. message .. "</fonts>"

	TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXSystem"):DisplaySystemMessage(formattedMessage)
end


-- events

serverEvent.OnClientEvent:Connect(DisplayServerMessage)
globalEvent.OnClientEvent:Connect(DisplayGlobalMessage)

how does it work now and what do you want to change

1 Like

this is what it says rn:
font color=“d4d4d4”(><font color=‘#A020F0’)<[GLOBAL]: GeneralBadNews had rolled Basic (1 in 2)</fonts(>

i want it to just say this:
[GLOBAL]: GeneralBadNews had rolled Basic (1 in 2)

idk if this is the problem but i think you are formatting the text twice, resulting in the already formatted text being fomatted again

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.