How to Make a Click to Receive Giver in Roblox

by Eli S in Living > Video Games

216 Views, 0 Favorites, 0 Comments

How to Make a Click to Receive Giver in Roblox

Screenshot (96).png

this tutorial will teach you how to make a giver that when clicked, awards the player a tool! if you have any questions, feel free comment and ask, I will probably be able to help you out. follow along to learn how!

Supplies

roblox studio logo.jpg

Things You Need:


1: laptop or desktop computer - mobile devices can't run studio

2: Roblox studio installed - see the Roblox creator website for how to download (I'll make a tutorial soon) link to website: Roblox Creator Hub

If You Want to Do It the Easy Way

Screenshot (101).png

place my model in your game and follow the instructions in the script called "READ ME". otherwise, follow the tutorial below.

model's asset id: 15375146638 (I apologize for the weird name, but Roblox will not let me publish it with any other name)


Open Studio and Set Vew

Screenshot (98).png

open studio and click on the game you want to make the giver in. before you start, make sure explorer and properties are enabled (you should see two windows named explorer and properties on the right). if not, then select the view tab at the top, and click on explorer and properties on the left. now that your view is all set up, we can move on to making the giver.


Make the Giver

Screenshot (99).png

now make a giver or get one from the model shop. if you do get one from the model shop, make sure it has no scripts in it. also, make a part that engulfs the whole giver, and set it's transparency to 1 and can-collide too false. also, make sure all your giver parts can drag around the workspace as one part and are all anchored. now add a click detector to the part that covers the whole giver. now find a tool from the marketplace that you want the giver to give and click on it. when the message comes up asking you if you want the scripts click "yes" but click "no" when it asks you if you want to put the tool in the starter pack. instead, drag the tool in to replicated storage.  

Scripting

Screenshot (102).png

now it's time to do the scripting. click the little + button next to the part that engulfs the giver and choose script from the menu. now re-name the script to whatever you want. then click twice fast on it and a script window will come up. delete the default text which is something along the lines of "print ("hello world")" and paste in the script below.


local tool = game.ReplicatedStorage.item -- change to the name of the tool it will give

local giver = script.Parent

 -- difines the parent of the script

local canGive = false

-- difines the can give verable


local function GiveTool (player)

-- difines the function


    if canGive == false then

-- tells the script to preform the action if cangive is false

       canGive = true -- makes cangive true

       local clone = tool:Clone()

-- clones the tool it will give

       clone.Parent = player.Backpack

-- places the clone in the players invintory

       wait (1)

-- waits one second before porceding

       canGive = false

-- sets can give to false

    end

-- end of code

end

-- end of code


 giver.ClickDetector.MouseClick:Connect(function(player) -- tells it to run the script when the giver is clicked

    GiveTool(player) -- same as above

end) -- end of script


now find the name of the tool you put in replacated storage and write that in place of "item" before the " -- change to the name of the tool it will give" comment. make sure it is exactly the same, with identical punctation and capitlization.


All Done!

FN7EDSJLR6D4XV9.png

awesome job, you're finished! play test your game, and you should find that when you click on the giver, you get the tool! if not, make sure you followed the instructions carefully.