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 » Scripting Helpers
Home Search
 

Re: Help edit this short script

Previous Thread :: Next Thread 
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 04:57 PM
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
children = player:GetChildren()
for _,v in pairs(children) do
if v:IsA("Tool") then
v:Destroy()
end
end
end
end)

I put it in a brick, and touching the brick is supposed to remove any tools in your inventory. It doesn't work, however.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Jun 2014 04:58 PM
children = player:GetChildren()

change that to

children = player.Backpack:GetChildren()
Report Abuse
Vuva is not online. Vuva
Joined: 22 Jan 2010
Total Posts: 1102
19 Jun 2014 04:59 PM
You also have to look for tools in the player's character model too, because when they equip a tool it moves to their character model.
Report Abuse
ManMinded is not online. ManMinded
Joined: 07 Oct 2012
Total Posts: 618
19 Jun 2014 04:59 PM
children = game.Players.LocalPlayer
children.Backpack:ClearAllChildren()

Instead of GetChildren, just clear all children is the localplayers backpack ontouch
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
19 Jun 2014 05:02 PM
@ManMinded: Unless things other than Tools are stored there.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 05:05 PM
Yeah I have some scripts in there I don't want to get rid of.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Jun 2014 05:06 PM
Did my fix work?
Report Abuse
ManMinded is not online. ManMinded
Joined: 07 Oct 2012
Total Posts: 618
19 Jun 2014 05:06 PM
put a script that gives you the tools that you need/lost after it
e.e
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Jun 2014 05:07 PM
@ManMinded
That would be more resource-consuming than the method he is using.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 05:11 PM
@ManMinded: Yeah, too complex, it would be far easier just to remove the tools right off the bat and keep the scripts.

@Destroyer, I switched the lines but no dice.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
19 Jun 2014 05:15 PM
script.Parent.Touched:connect(function(Touch)
if Touch.Parent:FindFirstChild("Humanoid") ~= nil then
Player = game.Workspace:GetPlayerFromCharacter(Touch.Parent)
for _,v in pairs(Player.Backpack:GetChildren()) do
if v:IsA("Tool") then
v:Destroy()
end
end
end
end)

I fixed it up for you.
Try that.

(make sure the script is a child of the part)
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 05:27 PM
still nothing. I looked while testing and the tool is in the player rather than the backpack, maybe that's why.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 05:32 PM
Anyone else have ideas?
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 05:38 PM
I can't seem to get this to work.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 05:47 PM
boomp
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 05:58 PM
bump
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 06:07 PM
I'm trying free models, it's not working.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 06:09 PM
I hope this isn't a new roblox problem or anything.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
19 Jun 2014 06:10 PM
Why did you put Tools in the Player..?
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 06:12 PM
I didn't put the tools in player. What's happening is that there's a tool lying on the ground, and when you pick it up it goes into player for some reason instead of the backpack. It's not a script I made.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
19 Jun 2014 06:13 PM
Oh, the CHARACTER, not the Player object?

Yeah, unequip tools first.

script.Parent.Touched:connect(function(Touch)
if Touch.Parent:FindFirstChild("Humanoid") ~= nil then
Player = game.Workspace:GetPlayerFromCharacter(Touch.Parent)
Player.Character.Humanoid:UnequipTools()
for _,v in pairs(Player.Backpack:GetChildren()) do
if v:IsA("Tool") then
v:Destroy()
end
end
end
end)
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 06:19 PM
Still doesn't seem to work for some reason.

Can anyone test this seperately and see if it works for them?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
19 Jun 2014 06:20 PM
script.Parent.Touched:connect(function(Touch)
if Touch.Parent:FindFirstChild("Humanoid") ~= nil then
Player = game.Workspace:GetPlayerFromCharacter(Touch.Parent)
for _,v in pairs(Player.Character:GetChildren()) do
if v:IsA("Tool") then
v:Destroy()
end
end
for _,v in pairs(Player.Backpack:GetChildren()) do
if v:IsA("Tool") then
v:Destroy()
end
end
end
end)
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
19 Jun 2014 06:23 PM
Still nothing. Gah this is infuriating. And this is basically the last script I need too.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
19 Jun 2014 06:23 PM
Output?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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