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
 

Anyone know why this isn't working right?

Previous Thread :: Next Thread 
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
30 Aug 2015 02:17 PM
It's suppose to be a giver part, but it checks to see if the player has all the tools.
If the player has all the tools from the giver, then it won't clone them.

Useful information about this:
It's cloning and parenting 8 tools, so if you're going to use :FindFirstChild, make sure it's checking for EVERY tool inside "Tools = {}".

Where it isn't working:
Script:17: attempt to call method 'FindFirstChild' (a nil value)
I'll mark out line 17 with "-- Line 17".

Tools = {}
BuildingTools = game:GetService("Lighting"):WaitForChild("DefaultBuildingTools"):GetChildren()
function GetTools()
for i = 1, #BuildingTools do
table.insert(Tools, BuildingTools[i])
end
end
function onTouched(hit)
if hit.Parent:FindFirstChild("Torso") then
Character = hit.Parent
Player = game.Players:GetPlayerFromCharacter(Character)
BackP = Player.Backpack:GetChildren()
Char = Player.Character:GetChildren()
function PlayerHasTools()
ToolsFound = false
for i = 1, #Tools do
if BackP:FindFirstChild(Tools[i].Name) or Char:FindFirstChild(Tools[i].Name) then -- Line 17
ToolsFound = true
end
end
if ToolsFound == true then
return true
else
return false
end
end
hasTools = PlayerHasTools()
if hasTools == false then
for i = 1, #Tools do
Tool = Tools[i]:clone()
Tool.Parent = Player:WaitForChild("Backpack")
end
end
end
end
script.Parent.Touched:connect(onTouched, GetTools())


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
30 Aug 2015 02:38 PM
Anyone?


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
30 Aug 2015 02:45 PM
Yo, anyone know?


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
30 Aug 2015 03:13 PM
Eugh, does anyone know?


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
30 Aug 2015 04:49 PM
Fixed it..

Tools = {}
BuildingTools = game:GetService("Lighting"):WaitForChild("DefaultBuildingTools"):GetChildren()
function GetTools()
for i = 1, #BuildingTools do
table.insert(Tools, BuildingTools[i])
end
end
function onTouched(hit)
if hit.Parent:FindFirstChild("Torso") then
Character = hit.Parent
Player = game.Players:GetPlayerFromCharacter(Character)
BackP = Player.Backpack:GetChildren()
Char = Player.Character:GetChildren()
function PlayerHasTools()
ToolsFound = false
for i = 1, #Tools do
for i = 1, #BackP do
if BackP[i].Name == Tools[i].Name then
ToolsFound = true
end
end
end
if ToolsFound == true then
return true
else
return false
end
end
HasTools = PlayerHasTools()
if HasTools == false then
for i = 1, #Tools do
Tool = Tools[i]:clone()
Tool.Parent = Player:WaitForChild("Backpack")
end
end
end
end
script.Parent.Touched:connect(onTouched, GetTools())




“Insane isn't always black or white. We're all pathological, in our own ways.”
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