What am I trying to do?
I’m trying to receive a player name from a local script and then locate that player within the game.
What is the issue?
To do this, I’m passing the player’s name from the local script to the server-script using an event. This is working fine - I’m using print debugging to confirm that the player name has been received correctly. However, when I go to locate that player in the game using the name, I get an error - P prints as nil (shown below). I’m not entirely sure how to go about it. This is what I tried:
print(target, "received from client.")
local p = game:GetService("Players"):FindFirstChild(target)
if p then
print("Player not located.")
Target prints correctly as the player name that was received from the local script, however P prints as nil.
I have no idea what args you are passing in the target but from the looks of it it looks like target already defines the player so there’s no need for the variable p, try testing it without the p variable.