Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wouldnt this Gui giver script be working?? i think i did everything right..

it should be giving me a tool but it errors what can i do to fix it? and how do you clone objects? my code:

local player = game:GetService("Players").LocalPlayer
local button = script.Parent
backpack = player.Backpack

button.Activated:Connect(function()
    local char = player.Character
    local seat = char:WaitForChild("stuff"):WaitForChild("Tools")
	
	for i,backpack in pairs(script.Backpack:GetChildren()) do
			local c = backpack:Clone()
			c.Parent = LocalPlayer.Backpack
	
	end 
end)



1 answer

✓ Accepted answer

Minor mistake, enjoy! :)

local plr = game.Players.LocalPlayer
local back = plr.Backpack
local button = script.Parent

button.Activated:Connect(function()
    local char = plr.Character
    local Sytem = char:WaitForChild("stuff"):WaitForChild("Backpack") 
    
    for _,v in pairs(script.Backpack:GetChildren()) do
      local c = System:Clone()
      c.Parent = back -- You didn't define "LocalPlayer"
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.