So, I have barely any Lua experience, but there is a script which google can't find(or I can't), but is it possible to add a script that makes it so it will force a person to talk. This might not be possible, but I want to make sure before I give up. If this is breaking any rules, please comment and I will change(or delete if needed) this post. Thanks, nd887 P.S I want the message to show up in the chat, not just a Bubble.
COMMUNITY QUESTION
Is it possible to make a part tht makes you talk?
1 answer
You can use the ChatService to accomplish this (Server Script):
local CS = game:GetService("ChatService")
CS.SpeakerAdded:Connect(function(Speaker)
script.Parent.Touched:Connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
if Speaker.Name == player.Name then
Speaker:SayMessage("Hi", "All")
end
end
end)
end)
The ChatService's SpeakerAdded event returns the speaker who entered the ChatChannel (in this case, that channel is All). From here you can use the SayMessage() method, which requires a string for the speaker to say and a string for the name of the ChatChannel to display the message in. A third, optional parameter is a dictionary that requires a string and a variant value.
This discussion is preserved as it was. New answers, comments, and votes are closed.

18 comments
Am I supposed to copy ChatService while I'm in test mode?
Copy it? What are you trying to do?
GetService() just returns the service given. It doesn't make a copy nor do you make a copy of the given service.
Oh, I thought that I would need to copy ChatService. Thanks.
How long does this take to register because I have another script that teleports you to another place and it takes about 7 seconds to register?
It registers when you hit the part.
It isn't working?
should I send a video
have you made sure the touch script deactivates when you touch it? if not then it will keep on firing the "Touched" Event over and over until you stop touching it
Why did you nest the event? Also it is Chat, not ChatService? And events don't return?
"Am I supposed to copy ChatService while I'm in test mode?" i want to go launch nukes at earth now
Never really tought of doing this, never knew it was a thing too. Learned something reading a random answer!
Ok, I fixed the problem. It should now work. Changed "Speaker" to "Speaker.Name".
also @incapaxx it's ChatService, not Chat. They're two different services.
@FlabbyBoiii Correct me if I am wrong, but the end) should end it
@RobloxWhizYT do you mean like this local CS = game:GetService("ChatService") CS.SpeakerAdded:Connect(function(Speaker.Name) script.Parent.Touched:Connect(function(part) local player = game.Players:GetPlayerFromCharacter(part.Parent) if player then if Speaker == plr.Name then Speaker:SayMessage("He warned me, but I ignored him. I am now gone.", "All") end end end)
No I do not mean that. Just follow the script.
@nd887, the end) will end the function but that doesn't mean it can't be touched again and since there's no delay between touches, it will fire the function multiple times before you can stand off of it