✓ Accepted answer
Well one problem I could find right away is that the Client-Server communication actually gives 3 arguments and not the two you specified.
All client-server communications that are utilized with the Event object provide the player itself.
So you can remove the "PlrName" argument and just utilize the player's name, here's a rework:
Edit: Kirot is right, I did a big booboo on this one rip. As he mentions in a comment, we should've done "OnServerEvent" instead.
Send Button:
script.Parent.MouseButton1Click:Connect(function()
local text = script.Parent.Parent.TextBox.Text
game.ReplicatedStorage.Message:FireServer(text)
end)
Label: (Ignore this one, it was a failure RIP)
game.ReplicatedStorage.Message.OnClientEvent:Connect(function(player, text)
local PlrName = player.Name
script.Parent.Text = PlrName..": "..text
end)
Rewrite of Label (This one doesn't work either rip):
game.ReplicatedStorage.Message.OnServerEvent:Connect(function(player, text)
local PlrName = player.Name
script.Parent.Text = PlrName..": "..text
end)
As for the text issue, it should've just returned the player's name. Are you sure the Send Button is the secondary or first parent of the script?
What I mean is:
Secondary Parent:
script --> 1st Parent --> SendButton (This is how it's working right now)
First Parent:
script --> SendButton (How I think it'll need to work like)
2 comments
You probably meant to use OnServerEvent
I changed my answer up as Kirot was correct.