New textchatservice help

Hi.

I’m a little tight on free time currently and these new changes to how textchat is handled has caused a bit of bother in some of my projects. I have an interphone system which puts chat bubbles on a receiver part in order to communicate from the front of an aircraft to another.

I don’t suppose someone could just give me a hand on converting this to work with the changes as right now it’s broken it.

Thanks!

Emily

local calling = false
local caller = nil
local animation = nil
local ogspeed = 16
local ogpower = 50
local Phone = script.Parent.Configuration.Phone.Value
local PhoneCFrame = script.Parent.Parent.PhoneWeld.CFrame
local otherphones = { -- List of other phones
	script.Parent.Configuration.OtherPhone1.Value,
	script.Parent.Configuration.OtherPhone2.Value
}

local ACP = script.Parent.Configuration.ACP.Value

local AIP = script.Parent.Parent.Parent.Parent.AIP
local FWD = AIP.FWD
local AFT = AIP.AFT
local AFT2 = AIP.AFT1

local Sound1 = ACP.Parent.InterphoneRed.Sound

local GroupID = script.Parent.Configuration.GroupID.Value
local RankID = script.Parent.Configuration.RankID.Value

function pickup()
	for _, phone in ipairs(otherphones) do
		phone.Click.ClickDetector.MouseClick:Wait()
	end
	Sound1:Stop()
end

function hangup()
	doodgaan:Disconnect()
	Phone.Changing.TimePosition = 1.7
	Phone.Changing:Resume()
	Sound1:Stop()
	calling = false
	script.CallingVal.Value = false
	if animation then
		animation:Stop()
	end
	animation = nil
	caller.Character.Humanoid.WalkSpeed = ogspeed
	caller.Character.Humanoid.JumpPower = ogpower
	Phone.WeldConstraint.Part1 = nil
	Phone.WeldConstraint.Enabled = false
	Phone.MainWeld.Enabled = true
	caller = nil
	Phone.CFrame = PhoneCFrame
	callsend:Disconnect()
	print("stopped call")
end


function sending(msg, recipient, speaker)
	local msg = tostring(msg)
	local ChatService = game:GetService("Chat")
	local filteredmessage = ChatService:FilterStringAsync(msg, speaker, speaker)


	local receiver1 = script.Parent.Configuration.Receiver1.Value.Phone
	local receiver2 = script.Parent.Configuration.Receiver2.Value.Phone

	game:GetService("Chat"):Chat(receiver1, filteredmessage)
	game:GetService("Chat"):Chat(receiver2, filteredmessage)
end

script.Parent.Click.ClickDetector.MouseClick:connect(function(plr)
	if plr:GetRankInGroup(GroupID) >= RankID then
		if (plr.Character.Head.Position - script.Parent.Main.Position).Magnitude < 5 then
			if not calling and caller == nil then
				calling = true
				script.CallingVal.Value = true
				caller = plr
				Phone.Changing.TimePosition = 0
				Phone.Changing:Play()
				animation = plr.Character.Humanoid:LoadAnimation(script.Calling)
				animation:Play()
				ogspeed = plr.Character.Humanoid.WalkSpeed
				ogpower = plr.Character.Humanoid.JumpPower
				plr.Character.Humanoid.WalkSpeed = 0
				plr.Character.Humanoid.JumpPower = 0
				script.Parent.Main.RopeConstraint.Attachment0 = nil
				Phone.MainWeld.Enabled = false
				Phone.CFrame = plr.Character.Head.CFrame * CFrame.new(0.8, -0.25,-0.6) * CFrame.Angles(math.rad(10.29),math.rad(91.49),math.rad(-125.56))
				Phone.WeldConstraint.Part1 = plr.Character.Head
				Phone.WeldConstraint.Enabled = true
				Phone.Anchored = false
				ACP.Material = Enum.Material.Neon
				ACP.Color = Color3.new(1, 0, 0)



				FWD.Display.SurfaceGui.Enabled = true
				FWD.Display.SurfaceGui.Memos.ALLATTND.Visible = true
				FWD.Normal.Flash.Enabled = true

				AFT.Display.SurfaceGui.Enabled = true
				AFT.Display.SurfaceGui.Memos.ALLATTND.Visible = true
				AFT.Normal.Flash.Enabled = true

				AFT2.Display.SurfaceGui.Enabled = true
				AFT2.Display.SurfaceGui.Memos.ALLATTND.Visible = true
				AFT2.Normal.Flash.Enabled = true


				local anyPhoneRinging = false
				for _, phone in ipairs(otherphones) do
					if not phone.PhoneScript.CallingVal.Value then
						anyPhoneRinging = true
						Sound1:Play()
						spawn(pickup)
						break
					end
				end

				script.Parent.Main.RopeConstraint.Attachment0 = script.Parent.Main.MainAttachment
				doodgaan = plr.CharacterRemoving:connect(hangup)
				callsend = plr.Chatted:connect(function(msg, recipient) sending(msg, recipient, plr) end)
				print("started call")
				wait(1)
				Phone.Changing:Stop()
			elseif calling and plr == caller then

				FWD.Display.SurfaceGui.Enabled = false
				FWD.Display.SurfaceGui.Memos.ALLATTND.Visible = false
				FWD.Normal.Flash.Enabled = false
				FWD.Normal.Material = Enum.Material.SmoothPlastic

				AFT.Display.SurfaceGui.Enabled = false
				AFT.Display.SurfaceGui.Memos.ALLATTND.Visible = false
				AFT.Normal.Flash.Enabled = false
				AFT.Normal.Material = Enum.Material.SmoothPlastic

				AFT2.Display.SurfaceGui.Enabled = false
				AFT2.Display.SurfaceGui.Memos.ALLATTND.Visible = false
				AFT2.Normal.Flash.Enabled = false
				AFT2.Normal.Material = Enum.Material.SmoothPlastic

				doodgaan:Disconnect()
				Phone.Changing.TimePosition = 1.7
				Phone.Changing:Resume()
				Sound1:Stop()
				calling = false
				script.CallingVal.Value = false
				caller = nil
				if animation then
					animation:Stop()
				end
				animation = nil
				ACP.Material = Enum.Material.SmoothPlastic
				ACP.Color = Color3.new(0.792157, 0.796078, 0.819608)
				plr.Character.Humanoid.WalkSpeed = ogspeed
				plr.Character.Humanoid.JumpPower = ogpower
				Phone.WeldConstraint.Part1 = nil
				Phone.WeldConstraint.Enabled = false
				Phone.CFrame = script.Parent.Parent.PhoneWeld.CFrame
				Phone.MainWeld.Enabled = true
				callsend:Disconnect()
				print("stopped call")
			end 
		end
	end
end)

Try changing this function to:

This.

local TextChatService = game:GetService("TextChatService")

function sending(msg, recipient, speaker)
    local msg = tostring(msg)
    local filteredMessage
    local success, err = pcall(function()
        filteredMessage = TextChatService:FilterStringForBroadcastAsync(msg, speaker)
    end)

    if not success then
        warn("Message filtering failed:", err)
        return
    end

    -- Update receiver parts with chat bubbles
    local receiver1 = script.Parent.Configuration.Receiver1.Value.Phone
    local receiver2 = script.Parent.Configuration.Receiver2.Value.Phone

    local bubblePart1 = receiver1:FindFirstChild("Display") or receiver1
    local bubblePart2 = receiver2:FindFirstChild("Display") or receiver2

    if bubblePart1 and bubblePart1:FindFirstChild("SurfaceGui") then
        bubblePart1.SurfaceGui.TextLabel.Text = filteredMessage
    end
    if bubblePart2 and bubblePart2:FindFirstChild("SurfaceGui") then
        bubblePart2.SurfaceGui.TextLabel.Text = filteredMessage
    end
end

let me know if it works… Im kinda not sure but you can try.

Nah doesn’t seem to :confused:
Says FilterStringForBroadcastAsync isn’t a valid member of textchatservice.

I’m looking through the documentation but struggling a little right now to figure out what it would be now

1 Like

Found a temp workaround, thanks though.

Just need to fix the element that filters the text then it should be all good.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.