Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you make a player's name show up in a textbox? [closed]

Asked by 5 years ago
Edited 5 years ago

So I'm trying to make something so when I type someones name the rest of the name would pop up

So if i type Bob in the textbox it would check if the player was in the server, if the player is then it would replace the textbox text with the full username

if i put hi but the full username was hiimbob then it would replace the text with hiimbob

heres a pic of what i mean https://cdn.discordapp.com/attachments/511168067515187211/586974531386736643/unknown.png when u type the d u can see the full username

if anyone can help then thanks

0
picture is blocked Gameplayer365247v2 1055 — 5y
0
oh lemem update it LEWIS1063 6 — 5y
0
add me on discord ill send it there LEWIS1063#0743 LEWIS1063 6 — 5y
0
added u there, user is world killer Gameplayer365247v2 1055 — 5y

Closed as Non-Descriptive by Fifkee, Gameplayer365247v2, Prestory, and alphawolvess

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago
Edited 5 years ago

First, we should check if the person is in the server when we press the Enter button.

If so, we autocomplete.

local Text = TEXTBOX_HERE;
local newText;
Text.Changed:Connect(function(t)
    if (newText) then newText:Destroy() end; --Delete any old text
    --Copy the text properties
    newText = Instance.new('TextLabel', script.Parent.Parent);
    newText.Name = 'NewText'
    newText.Font = Text.Font;
    newText.Text = '';
    newText.Size = Text.Size;
    newText.Position = Text.Position;
    newText.Visible = Text.Visible;
    newText.TextXAlignment = Text.TextXAlignment;
    newText.BackgroundTransparency = 1;
    newText.TextYAlignment = Text.TextYAlignment;
    newText.ZIndex = -50;
    newText.TextScaled = Text.TextScaled;
    newText.TextSize = Text.TextSize;
    local C = Text.TextColor3;
    newText.TextColor3 = Color3.fromRGB(C.r-50, C.g - 50, C.b - 50);
    --Check
    for i, v in pairs(game:GetService('Players'):GetPlayers()) do
        if (v.Name:lower():match(Text.Text:lower()) and Text.Text ~= '' ) then --if the name has a match for the textbox's text
            newText.Text = v.Name; 
            newText.Parent = Text.Parent;
        end
    end
end);

This will work if you type in bob, hiim, hi, ob, and etc. This works great if you remember a part of someone's name, but not the entire thing. Capitalization does not matter.

0
I get a red underling of the then on line 6 LEWIS1063 6 — 5y
0
Fixed, I completely forgot about the parenthesis. Try it now, please. Fifkee 2017 — 5y
0
it works but i want it to say the full name as im typing it, not when i press enter LEWIS1063 6 — 5y
0
finished done bye Fifkee 2017 — 5y
View all comments (5 more)
0
doesnt work LEWIS1063 6 — 5y
0
doubt it. worked on mine, error is on your side lol. Fifkee 2017 — 5y
0
what type of script, local or normal? LEWIS1063 6 — 5y
0
local Fifkee 2017 — 5y
0
do i put the script inside the textbox? LEWIS1063 6 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

gave u the answer in disc so can u accept this

0
u havent LEWIS1063 6 — 5y
0
have now Gameplayer365247v2 1055 — 5y
0
why did u take away the accept Gameplayer365247v2 1055 — 5y