Why is this script to change chat properties not working?

I’m trying to change the properties of the chat window. For some reason, this script isn’t working:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ChatSettingsRemote = ReplicatedStorage:WaitForChild("MainModule"):WaitForChild("ChatSettingsRemote")
local ChatSettings = ChatSettingsRemote:InvokeServer()
local ChatService = game:GetService("Chat")

ChatService:RegisterChatCallback(Enum.ChatCallbackType.OnCreatingChatWindow, function()
    print("Chat Window Settings Saving!")
    return ChatSettings.WindowSettings
end)

ChatService:SetBubbleChatSettings(ChatSettings.BubbleChatSettings)
print("Bubble Chat Settings Saved!")

For some reason, it doesn’t print Chat Window Settings Saving!. After a ton of bad scratching, I can’t figure this out. It’s in ReplicatedFirst, and it’s a LocalScript, but it won’t print. I need it set up with the RemoteFunction because of some backend stuff I’m doing, I can’t do it any other way. Why won’t this work? How do I fix it?

EDIT: I’ve tried this:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ChatSettings
local ChatService = game:GetService("Chat")

ChatService:RegisterChatCallback(Enum.ChatCallbackType.OnCreatingChatWindow, function()
	
	local ChatSettingsRemote = ReplicatedStorage:WaitForChild("MainModule"):WaitForChild("ChatSettingsRemote")
	ChatSettings = ChatSettingsRemote:InvokeServer()
	
    print("Chat Window Settings Saving!")

	return ChatSettings.WindowSettings
end)

ChatService:SetBubbleChatSettings(ChatSettings.BubbleChatSettings)
print("Bubble Chat Settings Saved!")

And it doesn’t work either. It still doesn’t print Chat Window Settings Saving!.

1 Like

(post withdrawn by author, will be deleted in 1 hour unless flagged)

Does it print anything before you call setbubblechatsettings?

No, it doesn’t print anything from the RegisterCallback function.

Not in the registercallback, but just a print statement right above setbubblechatsettings is called.

The only print above that is in the RegisterCallback? “ Chat Window Settings Saving!” doesn’t print, but “Bubble Chat Settings Saved!” does, if you’re asking.

I just tested this code in a studio test:

local ChatService = game:GetService("Chat")

local ChatSettings = {
	WindowSettings = {
		BubbleChatEnabled = true
	},
	BubbleChatSettings = {
		Font = Enum.Font.Oswald
	}
}

ChatService:RegisterChatCallback(Enum.ChatCallbackType.OnCreatingChatWindow, function()
	print("Chat Window Settings Saving!")
	return ChatSettings.WindowSettings
end)

ChatService:SetBubbleChatSettings(ChatSettings.BubbleChatSettings)
print("Bubble Chat Settings Saved!")

Done in a localscript in ReplicatedFirst. Works fine, so I’m sure the issue is to do with the remotefunction. Try adding a debug print before and after the remotefunction is invoked.

Yes, I already figured that out. When I add prints before and after, it seems to work fine. It’s just the RegisterCallback that doesn’t work.