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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|