I have errors using a (some scripts but the error is in this one script) script that is originated from YouTube and then modified. I don't know if the modification did this error tho, since I didn't really edit the line that has the error. Error: 'ServerScriptService.ChatGUIServerScript:6: attempt to concatenate upvalue 'connectedPlayer' (a userdata value)' Script Type: Script Code:
local ChatStorage = game.ServerStorage.ChatStorage game.Players.PlayerAdded:connect(function(connectedPlayer) connectedPlayer.Chatted:connect(function(sendMessage) local messageValue = Instance.new('StringValue', ChatStorage) messageValue.name = connectedPlayer..': '..sendMessage local replicatedMessage = messageValue:Clone() replicatedMessage.Parent = game.ReplicatedStorage.ClientChatStorage local ClientChatCtorage = replicatedMessage.Parent end) end)
I could link the video, but but its your choice. And I'm bad at LUA so expect me to not understand stuff. Anddddd I'm new here.
The problem is that "connectedPlayer" is the player object and not a string so you cannot concatenate an object.
game.Players.PlayerAdded:connect(function(connectedPlayer) connectedPlayer.Chatted:connect(function(sendMessage) print( connectedPlayer..': '..sendMessage) end) end)
I'm guessing that you want the players name which is a property of the player object, it is also a string.
game.Players.PlayerAdded:connect(function(connectedPlayer) connectedPlayer.Chatted:connect(function(sendMessage) print( connectedPlayer.Name..': '..sendMessage) end) end)
Hope this helps, please also check the wiki Lua_errors and look at the events you are using to understand what is passed as a parameter.