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

When an icon is clicked, how do i make so it clones a tool into the players backpack/starterpack?

Asked by 7 years ago
Edited 4 years ago

How do I make it so when an icon is clicked, it clones a tool into the players backpack/starterpack, and the icon you click remains in its place?

0
No requests thehybrid576 294 — 7y

1 answer

Log in to vote
1
Answered by
duckwit 1404 Moderation Voter
7 years ago

Instead of lumping your curiosity into one amorphous request, it'd be helpful to split apart the things which you are asking about and demonstrate how you have attempted to resolve the problem until now. It is much more fun for us, who sometimes enjoy writing answers, to see that you're putting some effort in as well.

Always start with the most useful ROBLOX Lua reference: the official wiki. Here you can search for pages that describe all of the objects and functionality that you're interested in.

Also, make sure you're familiar with the beginner scripting tutorials, such as this one and these ones.

Now, to point you in the right direction regarding your question:

Checkout the GUI ImageButton instance, and in particular the MouseButton1Click event.

Checkout the :Clone() method, which can be used on any object in a game.

All you need to do is :Connect() to the mouse event of the icon, use :Clone() on the tool which you want to copy, and then set the Parent field of the duplicated tool to the Player's backpack.

0
Uh.. So your saying I should do this in parts? iiDoge_Legend 3 — 7y
0
That is the nature of scripting, to put different bits together to achieve your goal. You could have asked: 'How do I do something when an icon is clicked?', and 'How do I clone a tool?', and 'How can I put something in the Player's backpack?'. Otherwise, we can't tell which part of the question you are stuck with. duckwit 1404 — 7y
Ad

Answer this question