I tried this, when the player doesn't exist, it prints that the player doesn't exist, but when the player does exist, it also prints that the player does not exist, how could i fix this?
local text = script.Parent.Text local Players = game:GetService("Players") script.Parent.FocusLost:Connect(function(enterPressed) if enterPressed then if not Players:FindFirstChild(text) then print("Player "..script.Parent.Text.." does not exist.") return end else print(script.Parent.Text) script.Parent.name.Value = script.Parent.Text script.Parent.Visible = false script.Parent.Parent.valueedit.Visible = true end end)
local Players = game:GetService("Players") script.Parent.FocusLost:Connect( function(enterPressed) if enterPressed then local text = script.Parent for _, player in pairs(Players:GetPlayers()) do if not text.Text == player.Name then print("Player " .. script.Parent.Text .. " does not exist.") return else print(script.Parent.Text) script.Parent.name.Value = script.Parent.Text script.Parent.Visible = false script.Parent.Parent.valueedit.Visible = true end end end end )
Figured it out guys, had to put local text = script.Parent.Text after the focus lost.