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

How do you make a tool-giver?

Asked by 10 years ago

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.

0
I've done this not to long ago, when I get home I well let you know if this question has not been answered yet. IntellectualBeing 430 — 10y

2 answers

Log in to vote
2
Answered by
Mowblow 117
10 years ago

Have a weapon in lighting, and a brick with a clickdetector with this script in it:'

local part = script.Parent
local detector = part.ClickDetector
local weapon = game.Lighting.WeaponName
local debounce = false

detector.MouseClick:connect(function(player) 
if debounce == false then
local g = weapon:Clone()
g.Parent = player.Backpack
debounce = true
wait(2)
debounce = false
end)

If this does not work, PM me @Mowblow for more help

0
bro gg u so good LUCATIVIOMAD 31 — 4y
Ad
Log in to vote
1
Answered by
OniiCh_n 410 Moderation Voter
10 years ago

Umm, this script might work for any tool really:

local sword = game.ReplicatedStorage.Sword --you can change sword to whatever name your tool is
local debounce = false

function giveTool()
if debounce == false then --not sure if denounce applies to click events, but idc
debounce = true

copy = sword:Clone()

copy.Parent = playerBackpack --this isn't the real player backpack, just find it through GetChildren because I'm not good with it

debounce = false

end

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

Answer this question