|
| 30 Jul 2011 01:27 PM |
My tool keeps saying that "Craft" is a nil value. I used: local Craft=Tool:findFirstChild("Craft") for it. Tool (also named Craft) just equals: script.Parent. (script is in the tool, named: "Crafting"). Craft is just the GUI in the tool. It keeps saying in the output: Players.Player.Backpack.Craft.Crafting:8: attempt to index local 'Craft' (a nil value) How can it be nil?! Plz help! D: |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Jul 2011 01:36 PM |
It seems to me you're searching in the wrong area.
Where is the GUI contents located? In the script? If so, you'd have to do
local Craft = script:FindFirstChild("Craft")
as script.Parent would refer to the handle, and you have nothing in the Handle but the script, which is named Crafting. Therefore, it cannot find the 'Craft', and returns it as if it's a nil value, |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 01:37 PM |
| No, the GUI is in the Tool. |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Jul 2011 01:43 PM |
Try this, then:
local ToolC = Tool:GetChildreb() for i = 1, #ToolC do
if ToolC[i].ClassName == "GuiMain" then -- Just replace the GuiMain with whatever Gui stuff you have local Craft = ToolC[i]
end end
Else, you could always do a check (in your current script):
if not Craft then print("Nope, can't find it") else --Your stuff-- end
It'd be easier if you posted the troublesome parts of your script, and defined where the locations of GUI and such were, in your first post. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 01:47 PM |
Ok, thanks! And btw, here's a root to the tool and stuff: Starterpack > Craft > Crafting, Handle, Craft.
|
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 01:50 PM |
| Okies, just notify me if it still don't work, and we'll try to troubleshoot it further, |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 01:57 PM |
Err it still isn't working... D: I put 'if not Craft then' and this time it didn't show any errors but the GUI won't show... Here's what I put at the beginning: local Tool=script.Parent local deb=false _G.Crafted={}
local player=game.Players:GetPlayerFromCharacter(Tool.Parent) local Craft=Tool:findFirstChild("Craft") if not Craft then print("Craft is nil again!") else (Rest of my code.) end
And I had to use GetPlayerFromCharacter(), since it's a tool and it's in my character. |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 02:05 PM |
| All aboard teh bump-train! Bump-Bump!! |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 02:09 PM |
Add this and tell me what happens in the output
assert(script.Parent:findFirstChild("Craft") ~= nil) |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 02:45 PM |
| Ok I will try that as soon as this ROBLOX Studio decides to either quit or start WORKING AGAIN from it's UNEXPECTED ERROR/HEART ATTACK!! >x3 >.< |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 02:54 PM |
| If it's been 'Not responding' for more than 30 seconds, it probably won't start responding again. It's a common bug and it never recovers. I left mine all night once, when I'd done hours (I know, I know, save every 30 minutes), of work, and lost it all 3: |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 02:58 PM |
| @Trap, Ok I tested but nothing shows in the output. (and no GUI!! D:<) |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 03:05 PM |
| OK I GIVE UP! This is so stupid and rediculous how it can't even find the GUI I put RIGHT THERE IN MY TOOL! I mine as well will just delete the stupid useless tool and have a NO-CRAFTING SURVIVAL GAME! >:l |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2011 03:07 PM |
| Put the GUI in the script, rather than the tool, and rename the GUI, then try again.. Always worth a try :P |
|
|
| Report Abuse |
|
|
kaspar87
|
  |
| Joined: 16 Aug 2010 |
| Total Posts: 69 |
|
| |
|