How do I make this script give more than one item (im new to scripting so idk)


I’m trying to learn how to script, any help on this would be really helpful.

1 Like

I would start by removing the destroy line.

This also looks like a very old script as its cloning from lighting.

Honestly I would find better code to learn from…

You’ll want to have a table with the tool names.

local Toolnames = {"Handgun","Othertool"}

Then you want the code to loop through the table and give the items.

for i, Toolname in pairs(Toolnames) do
    local Tool = game.Lighting.ToolFolder[Toolname]:Clone()
    Tool.Parent = Player.Backpack

This does seem like an old script though like @kingdom5 said. It uses :connect() which is deprecated. It’s also cloning from Lighting. If you watch any youtube tutorials just make sure it’s not too old and outdated.

1 Like

Okay thanks, I’ll try find a better tutorial online. I only used this one to try and learn from it though.

Hi! I understand this topic has been solved, but it is a very good coding practice to use game:GetService("Lighting") rather than game.Lighting, as it makes your code faster and more efficient.

Also, I see that :clone() is lowercase, which is deprecated. To use the updated version, use :Clone().

Also, change :connect() to :Connect() as that is also deprecated.

1 Like