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
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)