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: :FindFirstChild() Broken?

Previous Thread :: Next Thread 
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
29 Oct 2013 04:13 PM
for i = 1,72 do
I = string.sub(S.Inventory.Value,i*3-2,i*3)
if I ~= "aaa" then
GI = game.ServerStorage.GameItems:FindFirstChild(I)
IS = GI.Stats.Value

The last line of this script (this isn't the whole thing, just the part that's breaking) has an error that comes up saying that GI is nil. The value of I is "aab" and there is a StringValue in game.ServerStorage.GameItems named aab, so why is GI nil? This part of the script is in a PlayerAdded function, and when I print(I) it comes up with "aab". Anyone see whats wrong?





Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
29 Oct 2013 04:14 PM
>i*3-2
wouldn't that be i*1 making that useless
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
29 Oct 2013 04:21 PM
"I" needs to equal 1 3, 4 6, 7 9, etc.
Report Abuse
rtardbob123 is not online. rtardbob123
Joined: 13 Feb 2010
Total Posts: 15868
29 Oct 2013 05:13 PM
uh why not divide then
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
29 Oct 2013 06:59 PM
Why would I need to divide?
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
29 Oct 2013 08:22 PM
Here's a longer version, I can't post the whole thing because it keeps getting blocked for some reason:

function Inventory()
for i = 1,72 do
I = string.sub(S.Inventory.Value,i*3-2,i*3)
if I ~= "aaa" then
ST = game.ServerStorage.Guis.ScreenTip:clone()
GI = game.ServerStorage.GameItems:FindFirstChild(I)
IS = GI.Stats.Value -- Error here
end
end
end

GI should be a variable for game. ServerStorage.GameItems:FindFirstChild("aab") but no matter what I do is says GI is a nil value. I = "aab", and there is a StringValue in GameItems named aab. Inventory() gets called each time a new player joins.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
29 Oct 2013 08:27 PM
">i*3-2
wouldn't that be i*1 making that useless"
No. Its (i * 3) - 2, not i * (3 - 2).

"GI should be a variable for game. ServerStorage.GameItems:FindFirstChild("aab") but no matter what I do is says GI is a nil value. I = "aab", and there is a StringValue in GameItems named aab. Inventory() gets called each time a new player joins."

This sounds like its being executed in a local script, cause if it is then obv ServerStorage can't be touched on a client.

"Here's a longer version, I can't post the whole thing because it keeps getting blocked for some reason:"

Use something like pastebin.
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
29 Oct 2013 08:35 PM
"This sounds like its being executed in a local script"
The script is just a normal script inside ServerScriptService. Everything in it works fine apart from the :FindFirstChild(I) coming up as nil.

I also forgot to say that I don't really need to post a longer version, this is the only part that gets an error.
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
29 Oct 2013 08:40 PM
"I also forgot to say that I don't really need to post a longer version, this is the only part that gets an error."

How helpful.

Try this:

pastebin/LCfqiUwu

In theory, this should work, or its a problem on your end, I assume.
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
29 Oct 2013 08:45 PM
"pastebin/LCfqiUwu"
Er...what do I do with this? Nothing's coming up in the address bar.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Oct 2013 08:47 PM
copy it, add a dot com and enter.

wow -.-
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
29 Oct 2013 08:52 PM
Yeah...I knew that:

pastebin/t12srcjV
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
30 Oct 2013 02:47 PM
Bump.
Report Abuse
Kaffeine is not online. Kaffeine
Joined: 27 Oct 2013
Total Posts: 230
30 Oct 2013 02:56 PM
GI = game.ServerStorage.GameItems:FindFirstChild(I)
IS = nil

if (GI) then
IS = GI
end
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
30 Oct 2013 03:12 PM
Thank you so much Kaffeine. I've been trying to fix that for 3 days, finally works now.
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