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

Creating a Tool Dispenser? Or 'Giver?'

Asked by 8 years ago

I am currently trying to create a cafe for a group owned by a friend of mine and was having trouble figuring out how to make a giver that would dispense a specific tool on touch. Basically like the coffee machines, etc. you would see behind the counter of any ROBLOX personal server cafe. I've never done anything like this before, so please help me! Thanks.

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
8 years ago

First you would need a script inside of the "giver" or the block that gives the tool. Next, you would basically just need to do is something like this inside the script:

Tool=game.Lighting.Tool --Find the tool here

script.Parent.Touched:connect(function(Part) --Fires when brick is touched
    if Part.Parent:FindFirstChild("Humanoid") then --Checks if a character touched
        local Player=GetPlayerFromCharacter(Part.Parent)
        Tool:clone().Parent=Player.Backpack --Clones tool and gives to player
    end
end)

Anyways, if you edit it correctly to find the tool, everything should work perfectly fine. If you have any further questions please leave a comment below. Hope I helped :P

0
I ran into a problem with 'Player=GetPlayerFromCharacter(Part.Parent)' It kept telling me to ' try using local' and if I ever did it would ask for an identifier instead. Do you think you could help me with that? Thank you. Brisingr360 45 — 8y
0
Sure. All you would need to do is put Local before defining the variable. I'm not sure if this is what your problem is, but I think it should be fixed. dyler3 1510 — 8y
0
Thanks so much for all the help! :D Brisingr360 45 — 8y
Ad

Answer this question