When you fire a remote event to the server, the first parameter is the player and the rest of the parameters are the parameters inside :FireServer(these are the rest of your parameters)
This is the code that you did
playerName is the player object that you see in game.Players in the explorer, not your variable that you passed to the server. That would be the second parameter.
The game gets confused since you can't convert a player object to a string.
createPartEvent.OnServerEvent:Connect(function(playerName)
print(playerName)
end)
You need to put the player as the first parameter or else the rest of your parameters won't be correct.
#EDIT: USE THIS EXAMPLE VVVVV
The code below is correct since it has the player object as the first parameter followed by any other variables you passed when firing the event:
createPartEvent.OnServerEvent:Connect(function(player, playerName)
print(playerName)
end)
You could also do this since you can access the player's name from the player object,
createPartEvent.OnServerEvent:Connect(function(player)
print(player.Name)
end)
6 comments
But it prints the local player name. I want the model holder name. So therefore that wouldnt really make much sense
Use the second example that has two parameters and it should work.
I edited the post so you can see what I'm talking about
playerName is the parameter you put inside :FireServer()
shouldve been accepted
shouldve been accepted