TextChatService:WaitForChild("TextChannels"):WaitForChild("Logs").OnIncomingMessage = function(message)
local source = message.TextSource
if source then
if source:IsA("Player") then
message:Destroy()
end
end
end
I have a new script now from trialing a little bit.
local logsChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("Logs")
logsChannel.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
properties.Text = message.Text
if message.TextSource then
local sourcePlayer = Players:GetPlayerByUserId(message.TextSource.UserId)
if sourcePlayer then
return nil
end
end
return properties
end
I just read through the documentation (that the other guy sent) and TextSource is the user’s name and information on things like their permission to the channel, etc.
TextSource is the data that represents a speaker in a TextChannel.
I am attempting to figure it out, please have patience.
No. This is client sided now. The one before has had this part taken out:
And put in a client sided script:
local logsChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("Logs")
logsChannel.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")
properties.Text = message.Text
if message.TextSource then
local sourcePlayer = Players:GetPlayerByUserId(message.TextSource.UserId)
if sourcePlayer then
return nil
end
end
return properties
end
I have debugged this further and still no trace of deletion shown:
local logsChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("Logs")
logsChannel.OnIncomingMessage = function(message)
print("OnIncomingMessage triggered")
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
print("Message has TextSource")
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player then
print("Message from player: " .. player.Name)
properties.Text = ""
print("Message hidden")
return properties
else
print("Message from non-player or unknown user")
end
else
print("Message has no TextSource")
end
print("Allowing message to pass through")
properties.Text = message.Text
return properties
end