generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Clear inventory? Is this possible?

Previous Thread :: Next Thread 
chillybagpiper is not online. chillybagpiper
Joined: 28 Sep 2010
Total Posts: 1092
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
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
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 is not online. 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
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
16 Apr 2016 12:40 PM
ew
Report Abuse
MutigenHD is not online. 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 is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
16 Apr 2016 12:45 PM
^
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image