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

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

Asked by 4 years ago

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

Log in to vote
0
Answered by
0_2k 496 Moderation Voter
4 years ago

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)
Ad

Answer this question