The Parent property of Frame is locked [Comes from the Chat gui inside the PlayerGui]

I simply just want this error to stop showing up, the error is:

This error shows up whenever my script deletes a message out of the roblox default in-game chat, i have no idea why it throws this error and it would be nice if there is any fix for it, all what the delete message localscript does is:
grafik
Destroying the textlabels parent if the text inside the textlabel is equal to (exampel: !kick), but then it throws that error which i do not know how to solve, if someone would tell me how to solve it, i would appreciate it.

Well basically when you either destroy something or set it to nil and try using it again it locks the parent, an easy solution for this is cloning whatever you need cloning outside of the scope of whatever function your using and then make a variable cloning whatever you need cloned

EXAMPLE :

local UI = game.ReplicatedStorage.Example:Clone()

function CloneUI()
local ClonedUI = UI:Clone()
end
1 Like

You would need to fork the chat system in order to hide the message, If you wish to fork the Chat system here is a wiki article explaining how the Lua chat System works.

Also simply hiding or removing it will allow exploiters to still intercept the message.

Edited because “/” appears to only not show the message if its a command made with the Chat System my bad.

1 Like

Yeah i already made a post about the exploiter situation which someone told me to put that script into one of roblox’s core localscripts

Any local script can be turned off / removed by exploiters. ( Unless you mean to edit a pre existing one? which can still be bypassed )

Yeah but it would break their game if they turn off core scripts.

Else i was trying to find out how to make the server and the client play ping-pong with a server-sided random generated key and if the client wouldn’t catch the key, the server would kick the player

Your best bet is probably still just forking the Chat System as mentioned earlier, This would make so exploiters can’t intercept your message at all. + It would allow you to easily add commands.

Well i don’t need only commands, i’ve put words onto the blacklist which would be used to delete these chat messages, even if i’ve already used the :RemoveLastMessageFromChannel() function, the way it behaves is the reason why i’m not using it, regarding to that i’ve already made a post.

We are able to add custom commands / filtering behavior quite easily. We want to start with creating a folder inside the Chat service. Name the folder exactly ChatModules and then insert a BoolValue and set it to true, Name it InsertDefaultModules
Now we can insert a module script inside ChatModules. The Chat System expects to receive a function so we want to do.

local function Run(ChatService)

end

return Run

After this we want to use a RegisterProcessCommandsFunction on ChatService, This requires a FunctionId we can just give it “Blacklist”. This will fire when the player chats, It will give you three variables speakerName, message, channelName, In the example I am giving I am just showing how you would blacklist a word but it can be used to make commands as well. We should have code that looks something like this.

local function Run(ChatService)
	ChatService:RegisterProcessCommandsFunction("Blacklist", function(speakerName, message, channelName)

	end)
end
 
return Run 

Then the rest is quite simple, I made a table called BlacklistedWords that has one index with the key of “BadWord”. The intended purpose is that when you type “badword” into the chat it will not send. First i turned Message into lowercase just to avoid capitalization issues, Then I looped through the Blacklisted words and compared the message sent with the current key. If it was the the same I return true which will treat it as a command and not send. Outside the loop I return false which will process the command normally and send it. This is how my code turned out.

local BlockedWords = {“BadWord”}

local function Run(ChatService)
	ChatService:RegisterProcessCommandsFunction("Blacklist", function(speakerName, message, channelName)
		local messageLower = string.lower(message)
		for every, word in pairs(BlockedWords) do
			if string.find(messageLower, string.lower(word)) then
				return true
			end
		end
		return false
	end)
end
 
return Run

If you have any questions or if this didn’t help just let me know :slight_smile:

Used the resources from
Lua Chat System Wiki
Post by TheGamer101

Mentioning if this was your solution please mark it as solved :slight_smile:

1 Like