Need help with giving item typed in text box to player

I’m making a game where it revolves around typing what item you want inside of a text box.
What would be the best way to do this?
I’ve tried doing it through remoteevents, but I’m curious if there’s an easier way to do this.

Item i’m trying to give the player:
image

GUI:
image
Text button is what is pressed to confirm giving the player the item
text box is where the item name is typed

1 Like

try:

local Button = script.Parent -- Assuming the script is parented to the button.
local TextBox = script.Parent.Parent:WaitForChild("TextBox")
local player = script.Parent.Parent.Parent.Parent.Parent -- Get the Player's instance
function give()
    local item = game.ServerStorage:FindFirstChild(TextBox.Text)
    if item then
        item:Clone.Parent = player.Backpack
    end
end
Button.MouseButton1Click:Connect(give)
Button.TouchTap:Connect(give)

There might be a better way, but I don’t have access to studio currently.