Today, you'll be learning how to make a (clickable) tool giver.
Make sure to read through the whole thing, so you don't miss anything important.
STORING YOUR TOOL First, load your desired tool from the Toolbox, or select your own tool that you may have made. Then, move it to ReplicatedStorage (NOT ReplicatedFirst), the icon with two blue boxes and a red arrow. Make sure you name it to what you prefer. No spaces!!
THE PART THAT GIVES THE TOOL Switch to the "MODEL" tab, up top of your window, next to HOME. Around the middle of the UI, there should be a square that says "Part" under it. Click it. Select the part that you just created, name it to what you desire. Then: Select > Right-click > Insert Object > ClickDetector (it should look like a big white hand.) When you've inserted the ClickDetector: Select it > Right-click > Insert Object > Script When you've inserted the Script, double-click it.
THE SCRIPT Delete the "Hello World!" function inside of it.
Type from here.
--Variables local det = script.Parent --This sets our variable for our ClickDetector. local repstor = game:GetService("ReplicatedStorage") -- This calls ReplicatedStorage to work for us. local tool = repstor.YourToolNameHere --Replace "YourToolNameHere" with the name of your tool! local debounce = false --This will act as the cooldown. --Detecting the mouse, and main actions det.MouseClick:connect(function(plr) --This detects a click from a mouse. The "plr" is the player that has clicked it. if debounce == false then --This checks if the cooldown has passed. debounce = true --This sets the cooldown again. local copy = tool:Clone() --This function copies the tool from the ReplicatedStorage. copy.Parent = plr.Backpack -- This function sets the tool's location to the player's backpack. wait(1) --Waits 1 second. Replace the 1 with whatever you want your cooldown to be. debounce = false --Sets the cooldown again. end --Ends the statement, as you can probably tell. end)
Now we have a functioning tool giver, that even has a cooldown! I hope this wasn't too complicated, and it explained everything thoroughly enough.
Thank you for reading!
Med Written By xXisaacyoshimarioXx
See xXisaacyoshimarioXx's profile on Roblox