This is because your trying to receive the parameter “ChatService” but it doesn’t get sent in the local script. Here are adjustments you can make:
local ChatService = game:GetService("ChatService")
local function sayStatement()
print('recieved')
ChatService.SpeakerAdded:Connect(function(playerName)
local speaker = ChatService:GetSpeaker(playerName)
speaker:SayMessage("Hello, World!", "Yellow Team") -- message: "Hello, World!", chat channel: Yellow Team
print('said')
end)
end
return sayStatement
I tried the method but it gave me this output: 21:54:17.355 SpeakerAdded is not a valid member of ModuleScript "Chat.ChatServiceRunner.ChatService" - Client - Statements:5
Alright i’ve fixed it – For anyone viewing this in the future, i made a serverscript containing the text stuff and fired it on server whenever the textbutton was clicked. cheers.