So I've got this local script inside of a clickable gui and all
'Username' is a text box the player can enter another players username
local name = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
name.Backpack:GetChildren():Clone().Parent = game.Players:FindFirstChild(script.Parent.Parent.Username.Text).Backpack
name.Backpack:GetChildren():Destroy()
end)
When they click this gui button its supposed to take the players inventory and give it to the other player
It just down right isn't working. I've gone through many methods and rewrites of this but they just will not work.
No errors or anything popping up its just not working at all, the first players items dont get destroyed and the other player doesn't get any items.
Any ideas as to why this isn't working?
Edit: I tried to take peoples items individually that they were holding but that too didnt work

9 comments
I tested it with Player1 and Player2 but it didn't seem to work, I tried it with myself so I could see the output and it said Players.barrettr500.PlayerGui.Order.Frame.Accept.GUI Click:2: attempt to index a nil value
well that's actually your mistake, i guess what happended is it didn't find the player that had the name that was the same with the text in that text box
1 sec ill edit it
ok, now if the Text has the same name as the player this should work
It wasnt working so I put an else statement on your 'if wanted then' part and it always goes to else, the text should have the same name as the player, I even tried directly copying and pasting the username from Players and into the players gui
Hmmm, you want it to give the items to any player or to the chosen one?
Ok I just fixed it! the wanted variable had to be after the click because they didnt select who they wanted to be chosen till right before clicking!
but sinse its a local script it only goes into the players backpack according to the person sending it, you answered my first question, so now Im starting a new post
ok! glad to help