Referencing a value in a string?

So, I’m making a very basic custom Chat-box using Billboard GUIs and I’ve made a Server Script to insert them into the Player’s head.

A second Server Script is then supposed to detect when the player has sent a chat message, and update the text on the server. However, it doesnt seem to work:

ServerScriptService.CHATTER:3: invalid argument #2 (string expected, got Instance) 

This is the script i’m using:

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(msg)
		workspace.Characters[Player].Head.TextBar.Chat.Text = msg
	end)
end)

Any tips or help? Thanks.

1 Like
game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(msg)
		workspace.Characters[Player.Name].Head.TextBar.Chat.Text = msg
	end)
end)

Did not know that it required the name, Thanks!

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