Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

There is an error in the Chat Message script? Gives error saying it lacks permission?

Asked by 5 years ago
Edited 5 years ago

This script is located in a normal script in workspace. lua game.Players.PlayerAdded:connect(function(nP) nP.Chatted:connect(function(msg) local gcolor = nP.TeamColor if gcolor == game.Teams.Host.TeamColor then if msg == "!bubble" then game.Players:SetChatStyle(Enum.ChatStyle.Bubble) elseif msg == "!classic" then game.Players:SetChatStyle(Enum.ChatStyle.Classic) elseif msg == "!classicbubble" or "!bothchats" then game.Players:SetChatStyle(Enum.ChatStyle.ClassicAndBubble) end end end) end) Gives this error: The current identity (2) cannot SetChatStyle (lacking permission 1). Is there a way to fix or get around this error?

0
You can't use :SetChatStyle() in a localscript or a serverscript. awfulszn 394 — 5y

1 answer

Log in to vote
1
Answered by
awfulszn 394 Moderation Voter
5 years ago

The reasoning behind this error is that you cannot use :SetChatStyle() in a localscript or a serverscript

Wiki description: This function sets whether BubbleChat and ClassicChat are being used, and tells TeamChat and Chat what to do using the ChatStyleenum. Since this item is protected, attempting to use it in a Script or LocalScript will cause an error.

This function is used internally when the chat mode is set by the game.

You can only use :SetChatStyle() in the command bar or use it with plugins to receive no error.

Read more about this here.

If you have any comments or queries, be sure to comment!

Happy scripting!

Ad

Answer this question