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: not working, easy

Previous Thread :: Next Thread 
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 07:59 AM
kinda rushing through this urgent project and i might be making the stupidest of mistakes

function onTouch(hit)
if hit.Parent then
a = game.Players:FindFirstChild(hit.Parent.Name)
game.ServerStorage["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name.Backpack)
else return false
end
end
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 08:00 AM
oh nvm im an idiot i forgot the script.Parent:connect() thing xd
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
08 Jul 2014 08:01 AM
Try this,
function onTouch(hit)
if hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
a = game.Players:FindFirstChild(hit.Parent.Name)
game.ServerStorage["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name.Backpack)
else return false
end
end
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 08:03 AM
no w8 still not working and tried anon'
is it because the tool is blank and has no children?
ik that sounded wrong
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 08:06 AM
halp
Report Abuse
YeahNick is not online. YeahNick
Joined: 28 Feb 2009
Total Posts: 2536
08 Jul 2014 08:07 AM
Well,
1. Yeah, you forgot the connection
2. Put the tool in Lighting, that way the scripts in it don't run and stuff
3. FindFirstChild needs a string, but you're entering an object (hit.Parent.Name.BackPack)
4. You don't really need return
Should look like this

script.Parent.Touched:connect(function onTouch(hit)
if hit.Parent then
a = game.Players:FindFirstChild(hit.Parent.Name)
game.Lighting["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name).Backpack
end
end)
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 08:09 AM
@yeahnick '(' expected near 'onTouch'
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 08:13 AM
srs
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 08:18 AM
-_- it not wroking
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
08 Jul 2014 08:23 AM
function onTouch(hit)
if hit.Parent then
a = game.Players:FindFirstChild(hit.Parent.Name)
game.Lighting["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name).Backpack
end
end
script.Parent.Touched:connect(onTouch)
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
08 Jul 2014 08:24 AM
still not working i cant even figure out why
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
08 Jul 2014 08:24 AM

script.Parent.Touched:connect(function(hit)
if hit.Parent then
a = game.Players:FindFirstChild(hit.Parent.Name)
game.Lighting["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name).Backpack
end
end)
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
08 Jul 2014 08:25 AM
function onTouch(hit)
if hit.Parent and game.Players:FindFirstChild(hit.Parent.Name) then
a = game.Players:FindFirstChild(hit.Parent.Name)
game.Lighting["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name).Backpack
end
end
script.Parent.Touched:connect(onTouch)
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
08 Jul 2014 08:26 AM

script.Parent.Touched:connect(function(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
a = game.Players:FindFirstChild(hit.Parent.Name)
game.Lighting["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name).Backpack
end)
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