im reworking an old 2010s cell phone model, ive been able to fix majority of it with ChatGPT. my problem is that the gui displays the players recent chat, but is not filtering it. leaving players to say whatever they want.
this is the code for just the gui, im wondering how i can implement the official chat filtering into this?
Tool = script.Parent
local number = ""
local gui,gmain,msgs
local lastphrase = ""
local messageChanged = false
function onEquippedLocal()
number = ""
local character = Tool.Parent
local player = game.Players:GetPlayerFromCharacter(character)
gui = script.Parent.Cell:clone()
gui.Parent = player.PlayerGui
gmain = gui.Main
msgs = gmain.Messages
for i,p in pairs(gmain.Buttons:children()) do
if (p.Name ~= "Call") then
p.MouseButton1Click:connect(function()
number = number.. "" ..p.Text
gmain.Buttons.Call.Text = number
end)
else
p.MouseButton1Click:connect(function()
for a,b in pairs(game.Players:children()) do
if (b.UserId == tonumber(number)) then
Tool.Words.Value = "Player busy"
messageChanged = true
end
if (b.userId == tonumber(number)) and (b.Character:FindFirstChild("Humanoid") ~= nil) then
Tool.Calling.Value = b.Backpack.CellPhone
Tool.Words.Value = "Calling " ..b.Name.. "..."
messageChanged = true
elseif (b.userId == tonumber(number)) then
Tool.Words.Value = "Cannot find the player you requested."
messageChanged = true
end
end
number = ""
gmain.Buttons.Call.Text = number
end)
end
end
Tool.Words.Changed:connect(function()
if (Tool.Words.Value ~= "") and (Tool.Words.Value ~= lastphrase) and messageChanged then
lastphrase = Tool.Words.Value
if (msgs:findFirstChild("MSG5") ~= nil) then
for i = 5, 2, -1 do
local num1 = i
local num2 = i - 1
msgs:findFirstChild("MSG" ..num1).Text = msgs:findFirstChild("MSG" ..num2).Text
end
msgs.MSG1.Text = Tool.Words.Value
else
msgs.MSG1.Text = Tool.Words.Value
end
end
wait(0.1)
Tool.Words.Value = ""
end)
end
function onUnequippedLocal()
gui.Enabled = false
script.Disabled = true
end
Tool.Equipped:connect(onEquippedLocal)
Tool.Unequipped:connect(onUnequippedLocal)