Answered by
8 years ago Edited 8 years ago
Can you have the tool already instead of having to Insert it?
If so:
01 | local Part = game.Workspace:FindFirstChild( "Part" ) |
02 | local Tool = script:FindFirstChild( "Tool" ) |
05 | Part.Touched:connect( function (Part) |
06 | local Humanoid = Part.Parent:FindFirstChild( "Humanoid" ) |
07 | if Humanoid and Debounce = = false then |
09 | local Player = game.Players:GetPlayerFromCharacter(Part.Parent) |
11 | local ClonedTool = Tool:Clone() |
12 | ClonedTool.Parent = Player.Backpack |
Sorry if it's difficult to read.
I don't like my scripts tabbed.
Yeah, I know, I'm weird.
Anyways, what it does is:
Check if There is Humanoid, and if there is a Player.
If there is, it clones the tool, and places it into the Player's Backpack.
What I highly suggest is preventing it from making more than one copy of the clone.
If you'd like to prevent it from making multiple copies:
1 | local CharacterHasTool = Part.Parent:FindFirstChild(Tool.Name) |
2 | local PlayerHasTool = Player.Backpack:FindFirstChild(Tool.Name) |