I'm wondering why you can't send this through a remote event Also in case your wondering I am firing from a sword and want to get the sword holder's name
Keeps erroring and giving me Unable to cast value to Object
local name = game.Players.LocalPlayer.Character.Name print(name) event:FireClient(name)
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.
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) --the variable you sent: 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)