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

How to check what a person wrote in a textbox and give them an item named that?

So I want to be able to type in a players user name in a text box and a room number for the keycard (its for a hotel). I know how I can do that but I am just not sure how to actually give the item to them and how to give it to the player I am referencing. What I mean is I can check the textbox for the name that the staff would of typed in but and the room number but how would I be able to actually put the keycard that is typed in into the players backpack. Please help. Thank you! -TheWubbles123

2 answers

I don't know if this is a proper answer but,

a =label.Text -- fix this

if a == item.Name then
-- place in inventory
elseif -- and so on

end

So here's what you can do:

local item = {} -- Put the item directory here.

local textButton = {} -- Put the directory of the TextButton.
local textBox = {} -- Put the directory of the TextBox.

local function giveItem(player)
	local findPlayer = game.Players:FindFirstChild(player)
	if findPlayer then
		if item then 
			local clonedItem = item:Clone()
			clonedItem.Parent = findPlayer.Backpack
		else
			print("No item has been detected.")
		end
	end
end

textButton.MouseButton1Click:Connect(function()
	giveItem(textBox.Text)
end

PS: This is the LocalScript version.

And when you're trying to set the name of the user and room on the card:

local cardInstance = {} -- Put the card directory here.

function giveCard(player)
    local clonedCardInstance = cardInstance:Clone()
    clonedCardInstance.Parent = player.Backpack
	local roomText = {} -- Put the directory that the Room Text on the card is on.
	local userText = {} -- Put the directory that the name of the Player text on the card is on.
	userText.Name = player.Name
end

PS: This is the server script version, add it to the card-giver script.

7 comments

0

Update: Please edit the userText, roomText, textBox, textButton and the roomText scripting in the bottom script.

0

You're not supposed to give scripts.This is not a request site.

0

Thank you so much!

0

What do you mean by the item directory? What item?

0

Put the directory that the name of the Player text on the card is on. What does that mean too.

0

It means the you know game.Player[playerinstance.name].Keycard.RoomText type of thing.

0

I dont know D: I am just a beginner scripter...

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