Ok, so, this is my first post so I'm sorry if this is bad, but here we go.
I'm trying to make a rap game, and I can't figure out how to make it to where when a certain player is chatting, it puts the chat onto a text label. Can anyone help me out here? I'm very new to coding, so I tried searching it up for a while, but I couldn't find anything except for if all players were chatting, and I need to narrow it down to one. Thanks! By the way, this is what i've come up with so far.. :/
if rapper1.Value == Currentrapper.Value then game.Players.LocalPlayer.Chatted:Connect(function(msg) end) end end
rapper1 value is the player picked currentrapper is the player(rapper1) rapping -Aztralzz
Hello, Aztralzz!
If you use player.Chatted
, the assigned function will run everytime the player chats, so you can combine this to a if
to detect if it's the desired player that's chatting:
game.Players.LocalPlayer.Chatted:Connect(function(msg) if rapper1.Value == Currentrapper.Value then -- Here we check if the player that chatted is the one we want... print(msg) -- This prints the message end end)
To change a gui text value you can use .Text
NOTE: If you want to change a playerGui, you need to change under player.PlayerGui
If this answers your question, please accept it