Displaying player chat on a text label

Hello everyone, this is my first post on the DevForum.

I’m asking for help with an idea I’ve had for a game.

Essentially, everyone’s player character will be set to this fellow. When typing in the chat, the message typed will be displayed on the character’s screen.
image

I have attempted to do this through this code in a script in ServerScriptService:

local plr = game:GetService("Players")

plr.PlayerAdded:Connect(function(Player)

	Player.Chatted:Connect(function(msg)

		plr.Handle.Model.Screen.SurfaceGui.TextLabel.Text = msg

	end)

end)

Here is what the Explorer looks like for the player model:
image

If anybody could give me some pointers on how to rectify this issue, please do let me know! I’m not that experienced when it comes to scripting, but I am striving to try things for myself in order to get better.

Have a wonderful day,
ShockWaves921.

youre trying to find the screen inside of game.Players

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)

	Player.Chatted:Connect(function(msg)

		Player.Character.Handle.Model.Screen.SurfaceGui.TextLabel.Text = msg

	end)

end)

Oh, it appears that I am. Sorry if this is a simple question, but where would I look for the screen? How would I refer to the specific player model which chatted?

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)

	Player.Chatted:Connect(function(msg)

		Player.Character.Handle.Model.Screen.SurfaceGui.TextLabel.Text = msg

	end)

end)

The player who chatted is already referred in the Player.Chatted as you are looking for the specific player who chatted.

So you would use Player

Thank you for the help, DeveloperLewis! I’d totally forgotten about the Character property thing. The screen now displays the chatted text.
image

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