I want to force a player to chat when the click a UI Button. I’m not sure how to force a player to chat, though. Any help is appreciated.
You can use the Speaker:SayMessage(ToSay, Channel)
function of In-Experience Text Chat | Roblox Creator Documentation
I can’t download it. Any other way I see the example?
local ui = ui -- put the ui path here
local player = player -- puth the path of the player here
ui.MouseButton1Down:Connect(function()
game.Chat:Chat(player.Character.Head, "hello", Enum.ChatColor.White)
end)
Thanks! I will try this, I will tell you if this works.
It just makes a bubble chat appear above someone’s head, but it doesn’t actually show in chat.
yeah he can check In-Experience Text Chat | Roblox Creator Documentation for more information
i’ll check your rbxm file btw
It works but will it have bubble chat if I enable bubble chat on the game itself?
Yes, it will add bubble chat, if you do that.
yes, the model that Cramp sent it’s a ultimate force chat or something, although, it works with both chats (classic chat, bluble chat)
check it out
Hey, sorry to disturb but how can I get the player that clicked chat instead of them typing their user in? I’m currently half awake, so I don’t know if I can read through the script.
local ui = ui -- put the ui path here
local player = player -- puth the path of the player here
local chatservice = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService")
ui.MouseButton1Down:Connect(function()
local speaker = ChatService:GetSpeaker(player.Name) -- put the desired player here
speaker:SayMessage("hello", "All", {})
end)
make the player var as the starter gui parent, cuz the starter guis the "PlayerGui" and its parent
s the player.
Wait, what? Sorry still sleepy and I’m confused
the player variable must be the starter gui parent because it is the player gui parent’s when you play the game
Thanks. It works, have a good night/day!
Scripts does not belong in StarterGui, nor the PlayerGui.
UI-related things should be handled by the client (localscript).
Here’s what you should do instead:
- Add a RemoteEvent.
- Use RemoteEvent:FireServer() from the localscript.
- Force the player to speak with RemoteEvent.OnServerEvent.
More information can be found here: RemoteEvent | Roblox Creator Documentation
This worked for me. Ty. Also, the model in the solution is 70 robux. Just so you know.