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

How do I Acquire someone's username and then use it to automatically edit a text box?

Asked by 8 years ago

My current code is:

function onclick(player)
tools=player.Backpack:GetChildren()
if(player:FindFirstChild("Bags"))==nil then
folder=Instance.new("Folder")
folder.Name="Bags"
folder.Parent=player
else
player.Bags:ClearAllChildren()
end
for i=1,#tools do
if (tools[i]:FindFirstChild("Bag"))~=nil then
tools[i].Parent=player.Bags
end
end
location=script.Parent.Parent.Location.Position

baghold=player.Bags:GetChildren()

for i=1, #baghold do
wait(1)
baghold[i].Parent=Workspace
baghold[i].Handle.CFrame=CFrame.new(location)
if(baghold[i].Handle:FindFirstChild("Tag"))==nil then
tag=script.Tag:Clone()
tag.Parent=baghold[i]:FindFirstChild(baghold[i].MainPart.Value)
tag.Player.Text=player.Name
end
end

end
script.Parent.ClickDetector.MouseClick:connect(onclick) 

But I was wondering how I get someone's username and then it edits a text box to the player's name.

Script layout: http://prntscr.com/8ti0tg

0
Well it really depends on WHO's username you're acquiring. Goulstem 8144 — 8y

1 answer

Log in to vote
0
Answered by
Im_Kritz 334 Moderation Voter
8 years ago

Aight, get username then edit a textbox to it. Got it

If you are using a ClickDetector then it is easier since it returns the Player on click. You need to create the function and connect it with the ClickDetector. [ CONTENT DELETED ]

So here is the function and connection:

local function Click(Player)

end

script.Parent.ClickDetector.MouseClick:connect(Click)

Then you actually add the code that changes the TextLabel's Text into the Player's name. Pretty basic stuff:

local function Click(Player)
script.Tag.Player.Text = Player.Name
end

script.Parent.ClickDetector.MouseClick:connect(Click)
0
Thank you so much. TheHospitalDev 1134 — 8y
1
You're welcome man :) Im_Kritz 334 — 8y
Ad

Answer this question