Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can a script in the workspace call out a tool from inside a player? - (CONTINUED)

Asked by 8 years ago
Edited by Shawnyg 8 years ago

Thanks so much AlreadyPro for the script! So the script works completely fine, but one problem. The output gives me an error when the :Clone() function is called, as you can see on line 2 of the script below.

1local plr = game.Players.LocalPlayer
2local ShopTools = plr.Backpack:WaitForChild("BoughtTools"):GetChildren():Clone()
3table.foreach(ShopTools, function(i, v)
4    v.Parent = plr.Backpack
5end)

it gives me this error: Workspace.GameScript:67: attempt to call method 'Clone' (a nil value)" Would anyone know how to fix this error?

0
Formatted your code. Shawnyg 4330 — 8y
0
table.foreach is deprecated, use: "for i,v in pairs(ShopTools) do" instead RubenKan 3615 — 8y

Answer this question