You need to use .FocusLost event on textbox and get the .Text property inside of the textbox and use the players service function :GetUserIdFromNameAsync with the .Text property to get it and use .UserId in the result of the players service async
Depends, if its something like “online” you can use it because you want to other players see his userIds. But you will need to add more things to what i said in my first post
Button.MouseButton1Click:Connect(function() -- The button clicked
local Input = TextBox.Text -- Text inputted into textbox
if #Input == 0 then -- Checks if the textbox is empty
-- No username inputted (display error or do nothing)
else
local UserId = pcall(function()
return game.Players:GetUserIdFromNameAsync(Input) -- Get UserId
end)
if not UserId then -- If error then ...
UserId = 0 -- Set to a default value or display error
end
TextLabel.Text = Result -- Display result on text label
end
end)
I haven’t tested the code but I think it should work
Hope this helps