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: Tool Giver Script

Previous Thread :: Next Thread 
IL0LD is not online. IL0LD
Joined: 04 Sep 2011
Total Posts: 37
28 Oct 2011 09:48 PM
Error:
Workspace.Player Identifyer! Serial Code: 70.Head.GiveAToo:6: attempt to index global 'a' (a nil value)

Script:
function onTouched(part)
if part.Parent:FindFirstChild("Humanoid") ~= nil then
name = part.Parent.Name
player = game.Players:FindFirstChild(name)
a = script.Parent:FindFirstChild("Defend")
a.Parent = player.StarterGear
wait(0.5)
script.Parent.Name = "Thank you and good bye!"
wait(3)
script.Parent.Parent = nil
end
end
script.Parent.Touched:connect(onTouched)

Side Notes:
If you could add a debounce in there can you do it please?
I have a hopperbin nammed Defend in the brick but it wont work!
Report Abuse
IL0LD is not online. IL0LD
Joined: 04 Sep 2011
Total Posts: 37
28 Oct 2011 09:58 PM
Bump?
Report Abuse
IL0LD is not online. IL0LD
Joined: 04 Sep 2011
Total Posts: 37
28 Oct 2011 10:08 PM
*COUGH*BUHMP*COUGH*
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
28 Oct 2011 10:34 PM
Try this, I cleaned it up a little. Lemme know if it doesn't work.


debounce = true

script.Parent.Touched:connect(function(part)
if game.Players:GetPlayerFromCharacter(part.Parent) and debounce then
Player = game.Players:GetPlayerFromCharacter(part.Parent)
print(Player.Name.." touched part.")
if script.Parent:findFirstChild("Defend") then
script.Parent["Defend"]:clone().Parent = player.StarterGear
wait(0.5)
script.Parent.Name = "Thank you and good bye!"
wait(3)
script.Parent.Parent = nil
end
end
end)
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
28 Oct 2011 10:34 PM
Oh yeah and make sure "Defend" is inside of the Part.
Report Abuse
IL0LD is not online. IL0LD
Joined: 04 Sep 2011
Total Posts: 37
29 Oct 2011 08:53 AM
I think because its a hopperbin it wont give a tool :\
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
29 Oct 2011 12:51 PM
Did you try mine? What exactly are you trying to make?
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