|
| 04 Apr 2016 09:47 PM |
I wanting a script that removes a tool from a player. So the player clicks a block and It removes the tool from the player who clicked. Please help! 45 |
|
|
| Report Abuse |
|
|
Phonicz
|
  |
| Joined: 10 Apr 2010 |
| Total Posts: 400 |
|
|
| 04 Apr 2016 09:58 PM |
Dont know for sure how to do it but first off, please, PLEASE, learn to code and dont just take peoples knowledge from here and use it, Otherwise youll probally have a horrid game.
What you would do is find the person who clicked it, Look in said persons backpack, Look for said tool, Delete said tool, Done.
Look in the wiki for onclick or things around the click function and look on the wiki for finding the player.
After that pretty simple.
Remember, Coding is trial and error my friend.
Yours Truly, Phonicz |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2016 10:00 PM |
| Look in their backpack and character. |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2016 10:01 PM |
if player.Backpack:FindFirstchild('ToolName') ~= nil then player.Backpack:FindFirstchild('ToolName'):Destroy() else if player.Character:FindFirstchild('ToolName') ~= nil then player.Character:FindFirstchild('ToolName'):Destory() end |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Apr 2016 10:04 PM |
Put this inside the part (Normal Script)
local click = Instance.new('ClickDetector',script.Parent)
click.MouseClick:connect(function(player) if player.Backpack:FindFirstchild('ToolName') ~= nil then player.Backpack:FindFirstchild('ToolName'):Destroy() else if player.Character:FindFirstchild('ToolName') ~= nil then player.Character:FindFirstchild('ToolName'):Destory() end end) |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2016 06:09 PM |
| Please help (with a explanation please) |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2016 06:13 PM |
Lua, FindFirstChild will return a bool value, so you don't need to have ~= nil
|
|
|
| Report Abuse |
|
|
|
| 08 Apr 2016 06:20 PM |
| Please just give me a script that I just need to put in a block (THAT ALREADY HAS A CLICK DETECTOR) |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2016 06:22 PM |
| BTW the script has 6 parents until workspace (so 7 if you count workspace) |
|
|
| Report Abuse |
|
|
| |
|