Fixing Chat Color Changer from 2013

I want to fix the chat color changer in CloneTrooper1019’s Kool Killer

My problem is that when I select a different chat color, it changes the string value correctly but I don’t know how to make it change the color when the string value changes

function StartChat(player)
	repeat wait() until player:WaitForChild("ChatColor")
	player.Chatted:connect(function(msg)
		if player.Character:findFirstChild("Head") then
			game:GetService("Chat"):Chat(player.Character:findFirstChild("Head"),msg,Enum.ChatColor[player.ChatColor.Value])
		end
	end)
end

game.Players.PlayerAdded:connect(StartChat)

Here is proof it changes the value: image

function StartChat(player)
	repeat wait() until player:WaitForChild("ChatColor")
	player.Chatted:connect(function(msg)
		if player.Character:findFirstChild("Head") then
			game:GetService("Chat"):Chat(player.Character:findFirstChild("Head"),msg,Enum.ChatColor[player.ChatColor.Value])
		end
	end)
    player.ChatColor.Changed:Connect(function(value)
        game:GetService("Chat"):Chat(player.Character:findFirstChild("Head"),msg,Enum.ChatColor[player.ChatColor.Value])
    end)
end

game.Players.PlayerAdded:connect(StartChat)

You can use the Changed event to set it whenever the value is changed.

1 Like

I tried this to no success (no error in output)

Found the issue,

The F in find needs to be capitalized. I didn’t even notice.

function StartChat(player)
	repeat wait() until player:WaitForChild("ChatColor")
	player.Chatted:connect(function(msg)
		if player.Character:FindFirstChild("Head") then
			game:GetService("Chat"):Chat(player.Character:FindFirstChild("Head"),msg,Enum.ChatColor[player.ChatColor.Value])
		end
	end)
end

Lol it’s funny how easily missable this was.

dang I can’t believe it didn’t work

By any chance, is the code you linked in the thread in a server script while the script to change the chat colour a local script? If yes, is there a remote involved? If no, then there needs to be one. LocalScript changes do not propagate to the server except via a remote or where the client is authoritative, so the server never sees the client change the ChatColor value to a new colour, therefore it stays red.

Ok, how would I do it? I don’t understand how I could make something like this.

It’s relatively simple to make, Add a remote event in ReplicatedStorage and add a script in ServerScriptService and put this code in it

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, color)
	plr.ChatColor.Value = color
end

Now in your buttons that change the chat color, instead of doing a change for the ChatColor Value, just Fire this Remote and give it the color you want to change it to. If you need more help, you could send me the code that handles those 3 buttons and I could lend more help

1 Like

Thank you so much!
image

1 Like

I’m glad to be of help! I’m honestly glad I saw this post in my Suggested Topics considering it’s days old and you were probably really hoping for a fix which you now have! If you have anymore issues don’t be afraid to make another post!

1 Like