Like the ones we all see in the Free-Models in Studio. The type of tool-giver is a 'click-able' one When clicked it sends a tool to your inventory.
If you need a tool for an example, please use either a brick or a weapon from the Roblox "Weapons" set in the Toolbox.
Have a weapon in lighting, and a brick with a clickdetector with this script in it:'
01 | local part = script.Parent |
02 | local detector = part.ClickDetector |
03 | local weapon = game.Lighting.WeaponName |
04 | local debounce = false |
05 |
06 | detector.MouseClick:connect( function (player) |
07 | if debounce = = false then |
08 | local g = weapon:Clone() |
09 | g.Parent = player.Backpack |
10 | debounce = true |
11 | wait( 2 ) |
12 | debounce = false |
13 | end ) |
If this does not work, PM me @Mowblow for more help
Umm, this script might work for any tool really:
01 | local sword = game.ReplicatedStorage.Sword --you can change sword to whatever name your tool is |
02 | local debounce = false |
03 |
04 | function giveTool() |
05 | if debounce = = false then --not sure if denounce applies to click events, but idc |
06 | debounce = true |
07 |
08 | copy = sword:Clone() |
09 |
10 | copy.Parent = playerBackpack --this isn't the real player backpack, just find it through GetChildren because I'm not good with it |
11 |
12 | debounce = false |
13 |
14 | end |
15 |
16 | script.Parent.ClickDetector.MouseClick:connect(giveTool) --assuming script is in the part and there is a ClickDetector in there ;) |
Made this in a school iPad and it's meant to be an example, not actual working code. Didn't get to test it out yet :P