|
| 08 Oct 2012 12:21 AM |
| Where can I find a model where if you touch/click it, it gives you a tool, and if you want it to give you something again, it will delete your recently given tool to prevent inventory spam? |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 08 Oct 2012 12:45 AM |
Make it check the player's backpack to see if they have the tool. If they do own it, destroy it.
Ex.
local tool,tool_name = game.Lighting["TOOLNAME"],tool.Name
script.Parent.Touched:connect(function(hit) local plyr = tool:clone().Parent = game.Players:GetPlayerFromCharacter(hit.Parent) if plyr and plyr.Backpack:FindFirstChild(tool_name) then plyr.Backpack:FindFirstChild(tool_name):Destroy() tool:clone().Parent = plyr.Backpack else tool:clone().Parent = plyr.Backpack end end |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 08 Oct 2012 12:45 AM |
Woops! Forgot the ending parenthesis.
local tool,tool_name = game.Lighting["TOOLNAME"],tool.Name
script.Parent.Touched:connect(function(hit) local plyr = tool:clone().Parent = game.Players:GetPlayerFromCharacter(hit.Parent) if plyr and plyr.Backpack:FindFirstChild(tool_name) then plyr.Backpack:FindFirstChild(tool_name):Destroy() tool:clone().Parent = plyr.Backpack else tool:clone().Parent = plyr.Backpack end end) |
|
|
| Report Abuse |
|
|
| |
|