How to Drop a Tool by Pressing “E”
Download – Drop Tool Script
How To – Drop a Tool by Pressing “E”
What’s up everyone welcome to buzzygames, my name is buzzy games beth and today I’ll be teaching you how to drop a tool by pressing a key!
- So right now this is my weapon of choice, it’s just a normal bar or stick!
- We’re going to add a remote event inside of replicated storage and then renaming that to “dropevent”
- So a remote event is so that the entire server will see what’s happening and it’s not just on your side!
- Head over to the starterplayer folder, go ahead and open that up and then head over to starter player scripts and o fcourse we’re going to go ahead and add a localscript
- Delete the print statement and then let me go ahead and exit out these scripts real quick. So of course we have a very long list of variables over here and then we’re going to create a function where if any time a player presses the key, we’re going to set to be “e”, but you can go ahead and set the key code to anything you would like! Then the remoteevent is going to get triggered
- Next up we’re going to go ahead and add a script inside of serverscriptservice, so inside the script we want to code it where the the tool is going to have the drop event.
- So our parameter is going to be (players) we’re going to do local player model = game.workspace:findfirstchild.player.name and if playermode lthen local tool = player model: findfirstchild and then tool
- So we’re referencing these to our tool that we want to draw not just any kind of part but it’s going to be the tool that we want to draw
- Hop back into our game and you’ll see that immediately if you pick up your tool you go ahead and press e and it just drops it like that well done guys!