Having issues transfering items via. textbox

Hey so basically im trying to make this system where I transfer two items between backpacks. I have an UI for staff members to type a username when they have an item equipped, and then the script is supposed to take that item and transfer it to the target’s inventory.

My code is linked below, I don’t get any errors at all, but the item is not sent to the target. Thanks!

UsernameBox.FocusLost:Connect(function(enterpressed)
	local username = UsernameBox.Text
	local Target = game.Players:FindFirstChild(username)
	local EquippedItem = character:FindFirstChildWhichIsA('Tool') or character:FindFirstChildWhichIsA('Model')
	if EquippedItem and Target then
		EquippedItem = Target.Backpack
	else
		error('Player didnt have a valid equipped item or missing a valid username')
	end
end)

is this a local script? From the look of it it seems it might be.
Also remember when typing in the username it HAS to be exact from how youve coded it

yeah this is a localscript, the FocusLost didnt seem to work on a serverscript :smile:

ok so transferring an item would require using a server script, local scripts only effect the client they are parented to. So you would need to use remote events to send the info to the server, the server than parents the item to the target

Ah thanks! I’ll give this a shot. I was certain I could move items on the client , silly me.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.