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

Customize Player's Name Through TextBox?

Asked by 6 years ago
Edited 6 years ago

Not like their "name", but what they want to put on like a jersey or something. I'll show you the script, it kinda follows PeasFactory's script.

(ChangeJersey Gui Script)

local button = script.Parent
local buttontext = button.Text
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local humanoid = char:WaitForChild('Humanoid')
local torso = char:WaitForChild('Torso')
local torsogui = torso:WaitForChild('Jersey')
local guitext = torsogui:WaitForChild('TextLabel')


button.Changed:connect(function()
    if buttontext then
        guitext.Text = buttontext
    end
end)

button.FocusLost:connect(function(enterPressed) --tried using this method whenever they pressed enter, but idk if it really matters
    if enterPressed then
        if buttontext == '[name here]' then
            buttontext = player.Name
        end
    else
        buttontext = guitext.Text
    end
end)

(StarterGui Jersey)

wait(5)
local plr=game.Players.LocalPlayer
local surf=Instance.new('SurfaceGui',plr.Character:WaitForChild'Torso')
surf.Adornee=plr.Character.Torso
surf.Face='Back'
surf.CanvasSize=Vector2.new(100,100)
surf.Name = 'Jersey'
local txt=Instance.new("TextLabel",surf)
txt.BackgroundTransparency=1
txt.TextStrokeTransparency=0
txt.TextColor3=Color3.new(1,1,1)
txt.Text=plr.Name
txt.Size=UDim2.new(1,0,0.5,0)
txt.Position=UDim2.new(0,0,0,0)
txt.FontSize=Enum.FontSize.Size12
txt.TextScaled=false
txt.TextWrapped=true

If you could also help me implement a Filtering Text thingy, that would be wonderful. (:

StarterGUI

In-Game

Video

(Just want it so that whenever they change the text, it will be equivalent to the text on their back.)

Thank you guys for all the help, my game wouldn't be successful without you guys today.

-LukeGabrieI aka EnergyBrickz

1 answer

Log in to vote
0
Answered by
blowup999 659 Moderation Voter
6 years ago

You should have a TextBox for receiving the actual name and then use a remoteevent to fire the server with the text in the TextBox, from there you must filter it to comply with roblox, then can set the TextLabel's text in the SurfaceGui on the player to replicated the name to what all players can see

Ad

Answer this question