basically, i have a shop and when players buy an item from it, the item is put into a folder in the player's backpack named "BoughtTools." This is so a script can call out the weapons at any time it likes, and to keep the player from having their weapons in the lobby or just outside the game round in general. But, for some reason, i call out the items in this folder and it does nothing. Its does not give me an error or anything. This is the script below. Do i need to change the parent in any way? Could anyone please tell me whats wrong with it and correct the error? Help is GREATLY appreciated! :)
local plr = game.Players.LocalPlayer local ShopTools = plr.Backpack.BoughtTools:GetChildren() local ClonedTools = ShopTools:Clone() ClonedTools.parent = plr.Bacpack
-TheBlazingMinatour
Yes, you do need to change the Parent
, not parent
. Capitalization matters when messing with a part, or any object's, properties. Also, ShopTools is now a table, not just a bunch of objects. You would need to iterate through the function and parent them to the player's Backpack.
Correct code would be
local plr = game.Players.LocalPlayer local ShopTools = plr.Backpack:WaitForChild("BoughtTools"):GetChildren():Clone() table.foreach(ShopTools, function(i, v) v.Parent = plr.Backpack end)