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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

0
Update: Please edit the userText, roomText, textBox, textButton and the roomText scripting in the bottom script. User#17915 0 — 5y
0
You're not supposed to give scripts.This is not a request site. Thesquid13 301 — 5y
0
Thank you so much! TheWubbles123 -3 — 5y
0
What do you mean by the item directory? What item? TheWubbles123 -3 — 5y
View all comments (3 more)
0
Put the directory that the name of the Player text on the card is on. What does that mean too. TheWubbles123 -3 — 5y
0
It means the you know game.Player[playerinstance.name].Keycard.RoomText type of thing. User#17915 0 — 5y
0
I dont know D: I am just a beginner scripter... TheWubbles123 -3 — 5y

Answer this question