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

User Input, Making a Username In-game?

Asked by 10 years ago

I've seen it in some games, and i think it would be a great feature in my game. However, the great thing know as "un-education" on User Input, lacks on my part.

How would i do the following:

Make it where in a Gui, it will say "Type a username", then have an area where one could type their username. WHAT do i use for them to type it in? A Textlabel, button, what?

Then, what do i script to make them able to change their in-game username to that? I don't know anything about userinput, and i haven't seen any tutorials on it.

Would someone mind helping me with this?

1 answer

Log in to vote
1
Answered by 10 years ago

for "Type a Username" do a TextBox, for the username to appear make a BillBoard and assign it to players head then put a textlabel inside the billboard and put the characters name inside the textlabel.

Put this code in a localscript

local Player = game.Players.LocalPlayer
local TB  = script.Parent.TextBox --TB = TextBox
local BB = game.ReplicatedStorage.NameBoard --BB = BillBoard

TB.FocusLost:connect(function(enter)
    if enter then -- if player presses enter
        BC = BB:Clone() --BC = BBClone
        BC.Adornee = Player.Character.Head
        BC.Label.Text = TB.Text -- Label is a textlabel
        BC.Parent = Player.Character.Head
    end
end)

Ad

Answer this question