I currently am just using this code to adornee a chat bubble to a players character and it works well on your client but not server side, so my thought was to fire a RemoteEvent to the server and then the server fires to all clients the player whose talking and then someone the client would pick it up and adornee a chat billboard to that character. Problem I fear with that is latency. Client-Server-Client communication can sometimes take 2-3 seconds, and the message could have been sent before then.
local Players = game:GetService('Players')
local UserInputService = game:GetService('UserInputService')
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HUD = script.Parent
local function TextBoxFocused(textBox)
if textBox.Name ~= 'ChatBar' then return end
HUD.Adornee = Character
end
local function TextBoxFocusReleased(textBox)
if textBox.Name ~= 'ChatBar' then return end
HUD.Adornee = nil
end
UserInputService.TextBoxFocused:Connect(TextBoxFocused)
UserInputService.TextBoxFocusReleased:Connect(TextBoxFocusReleased)
I think you could just use the remote event as is and have no problem whatsoever. If there is latency then it’d just be the players ping I think and not the remote event.
Do you get what I’m saying though. Instead of setting the adornee on the client, just fire a remote event to the server saying to adorn it, then have it change it on the server, so it’s a global change that everyone sees.
That’s typically how you would handle things in this situation.
It’s also the same way I did it when I made my own custom chat that said when people were typing.
If you swap it from PlayerGui, and have it as a child of the object you’re adorning it to, you can access it with the server and set the adornee globally. This is how games make NPC bubbles above heads like the example below from duckie simulator.