It’s a battle royale game and I want the players’ text messages to appear above them (Which the game does fine), it just needs to apply the chat filter to the messages, because I don’t know if you know this, but little timmy should not be able to curse and have everyone see that.
(Most of the stuff below doesn’t matter)
game:GetService(“Players”).PlayerAdded:Connect(function(player)
local chats = 0
local last = Instance.new(“StringValue”)
last.Name = “LastMessage”
last.Parent = player
player.Chatted:Connect(function(message)
if player.Character then
if player.Character:FindFirstChild(“ChatBar”) then
– I’ve been putting the filtering stuff here
last.Value = message
local text = player.Character.ChatBar.text
text.Text = “”
text.TextTransparency = 0
for i = 1, #message do
if last.Value ~= message then return end
if player.Character then
if player.Character:FindFirstChild(“BusTeleporterScript”) then
if player.Character.BusTeleporterScript.Enabled == false then
local parts = player.Character:GetChildren()
for _, part in pairs(player.Character:GetChildren()) do
if part.Name == “Fishbrella” then
if part:IsA(“Model”) == false then
break
end
end
end
if player.Character:FindFirstChild(“HumanoidRootPart”) then
local audio = game.ServerStorage.Sounds.Chat:Clone()
audio.Parent = player.Character.HumanoidRootPart
audio.Name = “ChatSound”
audio:Play()
end
end
else
if player.Character then
if player.Character:FindFirstChild(“HumanoidRootPart”) then
local audio = game.ServerStorage.Sounds.Chat:Clone()
audio.Parent = player.Character.HumanoidRootPart
audio.Name = “ChatSound”
audio:Play()
end
end
end
end
local char = message:sub(i,i)
text.Text = text.Text…char
wait(0.075)
if player.Character then
if player.Character.HumanoidRootPart:FindFirstChild(“ChatSound”) then
player.Character.HumanoidRootPart.ChatSound:Destroy()
end
end
end
chats += 1
wait(5)
chats -= 1
if last.Value == message then
if chats > 0 then return end
repeat
wait(0.025)
text.TextTransparency += 0.1
until text.TextTransparency == 1 or last.Value ~= message
if last.Value ~= message then return end
text.Text = “”
chats = 0
end
end
end
end)
end)
I’ve tried GetNonChatStringForBroadcastAsync() [It supposedly doesn’t work for chat messages], FilterStringAsync() [It needed a player the message was going to], FilterStringForBroadcast() [But of course it only works on the client], and some other methods I forgot about. All of which failed.
Any help is appreciated, and I don’t know how I manage to get myself in these situations where the Roblox AI and Documentations are no help, but I do somehow, and I can’t say I enjoy that.