My explorer set up can be found here: http://tinypic.com/r/2hg4x7b/9
NOTE : I have a script that puts the whole screen gui into the players. In Addition, this is the explorer before I put the things from server storage into replicated.
local name = script.Parent.Nam.Value local items = game.ServerStorage.Items local player = game.Players.LocalPlayer print(name) script.Parent.MouseButton1Click:connect(function() local found = items:FindFirstChild(name) --possible mistake if found then local c = found:Clone() c.Parent = player.Backpack end end)
Hello. I'm practicing at the same time working on a game. What I did was that I inserted into one of the many frames so that you can click and it gives you an item like an inventory. So far I got a script to equip with q and a bunch of others like selection boxes. Now, I need to be able to take items out of the inventory and put into default roblox backpack. Thats what I am trying to do with this script. I'm trying to get the name value from a string value I put in one of the frames. That name value will determine what Item I get back. So if I want an item called gun the name value in the string value in the frame should match. So once the name value gets taken I want the script to look through a folder named items. In that folder is going to be my tools and stuff. I want the script to use the name value in the frame and use that to look for the same name in the items folder. IDK what I'm doing wrong in my script as i'm pretty stumped atm. Perhaps I'm making it harder for myself? I feel like the mistake is around line 8 or:
local found = items:FindFirstChild(name) --possible mistake
note this script is in a regular script (use to be in local) in the imagebutton in a frame in a screengui in local player.
UPDATE: I switched the script to this.
local name = script.Parent.Nam.Value -- adding local before a variables makes it not a global variable and it won't get mixed up between other scripts local items = game.ReplicatedStorage.Items local player = game.Players.LocalPlayer print(name) script.Parent.MouseButton1Click:connect(function() local found = items:FindFirstChild(name) local c = found:Clone() print("clicked") print("hi") c.Parent = player.Backpack end)
an error saying 11:49:48.877 - Players.Player.PlayerGui.InventoryGui.Frame.one.Script:10: attempt to index local 'found' (a nil value) pops up
I TRIED PRINTING FOUDN AND ITS A NIL VALUE