So, I have a local script in which when a player's username is entered into a textBox and another button is clicked it will loop through all of the players in the game. However, it's not working and when testing it on studio (Not sure this is where another problem may lie) it says that the player doesn't exist. I was just wondering whether I might have to send the player's name through remoteEvent to the server and then for the server to do the search, but I wasn't entirely sure. However, this is the code that I have got so far.
Code:
textButton.MouseButton1Click:Connect(function()
textEntered = enterName.Text
for i,v in pairs(players:GetPlayers()) do
if textEntered == v.Name then
-- There is more but this is the only part that I imagine being useful for my problem
This just got edited

5 comments
Are you trying to check if the username that was entered is a player that is in the game?
Yes.
That's why I was unsure if I would have to use RE's.
Since you're not changing anything on the server, this can be done in a local script. You should just be able to compare the strings of the text entered with the names of each player in the game.
That's what I did do, but when testing on studio there seems to be an error. I'll edit that bit into the code and if that doesn't work I'll test it on Roblox itself and not studio. It works when I click play normally, but when I use the option of testing for 2< players and the players names are 'Player1' and 'Player2' it doesn't work.