Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you help me?

Help! I want to make a script that when you type a player name in the gui that player will recive the item you are holding but i don't know how, thanks.

1 answer

I think this is what you're looking for:

NameGui = --Put the path to the GUI containing the player's name that is being typed (For example, script.Parent.Parent.TextBox)
PlayerGui = script --Put .Parent's here until you reach the PlayerGui, which would be the StarterGui in studio.

function Give()
	Players = game.Players:GetChildren()
	for i = 1,#Players do
		wait()
		if Players[i].Name == NameGui.Text then
			PotentialTools = PlayerGui.Parent.Character:GetChildren()
			for i = 1,#PotentialTools do
				wait()
				if PotentialTools[i].ClassName == "Tool" or PotentialTools[i].ClassName == "HopperBin" then
					PotentialTools[i].Parent = game.Players:FindFirstChild(NameGui.Text).Backpack
					-- PotentialTools[i].Parent = game.Players:FindFirstChild(NameGui.Text).StarterGear
-- Remove the two dash's from the line above if you want the player to get that item every time they spawn.
				end
			end
		end
	end
end

script.Parent.MouseButton1Click:connect(Give)

You'd want to put that in the button the player would be clicking.

It should work, but I haven't tried it, or anything like it.

This discussion is preserved as it was. New answers, comments, and votes are closed.