|
| 16 Apr 2016 12:33 PM |
I want it so when the player walks through a part (CanCollide off obviously.) it removes all of their tools.
Help would be amazing.
#Code print(" Graphic Designer, Graphic Illustrator, Entrepreneur") |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 12:35 PM |
trigger.Touched:connect(function(touchedPart) local character = touchedPart.Parent local player = game.Players:GetPlayerFromCharacter(character)
if player then player.Backpack:ClearAllChildren()
--If the player has equipped a tool, remove that one too for _, tool in pairs(character) do if tool.ClassName == "Tool" then tool:Destroy() end end end end) |
|
|
| Report Abuse |
|
|
error9999
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 1593 |
|
|
| 16 Apr 2016 12:37 PM |
part.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(hit.Parent.Name) then game.Players[hit.Parent.Name].Backpack:ClearAllChildren() for i,v in next, hit.Parent:GetChildren() do if v.ClassName == "Tool" then v:Destroy() end end end end) |
|
|
| Report Abuse |
|
|
| |
|
MutigenHD
|
  |
| Joined: 28 Aug 2014 |
| Total Posts: 516 |
|
|
| 16 Apr 2016 12:41 PM |
local Part = script.Parent
Part.Touched:connect(function(TouchingPart) if TouchingPart.Parent:FindFirstChild("Humanoid") then local Character = TouchingPart.Parent local Player = game.Players:GetPlayerFromCharacter(Character) Character.Humanoid:UnequipTools() Player.Backpack:ClearAllChildren() end end)
|
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|