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
 

Re: Why does this give an error?!

Previous Thread :: Next Thread 
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:31 PM
So I have this in my script: local repstorage = game:GetService("ReplicatedStorage") local object = ######################################################################################################## And there is a text label in the exact place referenced and it's text is the same as a models name in replicated storage in the reference place, but when I run a server it shows an error saying that object is a nil value.
Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:32 PM
supposed to be:

local object = repstorage :
FindFirstChild("Items").Furniture:FindFirstChild(script.Parent.Parent.TextLabel.Text):Clone()




Report Abuse
Ajastra is not online. Ajastra
Joined: 01 Aug 2017
Total Posts: 1461
16 Aug 2017 02:33 PM
Hi TheM0rt. Try to use the Preview option to check if what you're going to get hit by the filter before you post. :)


Report Abuse
Ajastra is not online. Ajastra
Joined: 01 Aug 2017
Total Posts: 1461
16 Aug 2017 02:35 PM
The Instance:FindFirstChild() calls you have are useless, because Instance:FindFirstChild() returns the instance or nil. If game.ReplicatedStorage.Items does not exist, you will attempt to access ############## ################ should use if statements to check for the return values of Instance:FindFirstChild().
Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:37 PM
local object = repstorage . Items.Furniture:FindFirstChild(script.Parent.Parent.TextLabel.Text):Clone()


Report Abuse
Ajastra is not online. Ajastra
Joined: 01 Aug 2017
Total Posts: 1461
16 Aug 2017 02:38 PM
See but you're attempting to clone nil if the Text is not a valid child of Furniture.


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:38 PM
I get the exact same error if I do this.


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:39 PM
So how could I use an if statement?


Report Abuse
Ajastra is not online. Ajastra
Joined: 01 Aug 2017
Total Posts: 1461
16 Aug 2017 02:40 PM
if thing found then
clone
end


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:42 PM
But that is the problem. I know for a fact that it is in replicated storage, but it still gives an error.


Report Abuse
Ajastra is not online. Ajastra
Joined: 01 Aug 2017
Total Posts: 1461
16 Aug 2017 02:42 PM
What is your error in output?


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:43 PM
: attempt to index upvalue 'object' (a nil value)


Report Abuse
Ajastra is not online. Ajastra
Joined: 01 Aug 2017
Total Posts: 1461
16 Aug 2017 02:48 PM
Instance:Clone() would error if you attempted to clone nil.

Perhaps the object's Archivable property is set to false, which would result in Instnace:Clone() returning nil?


Report Abuse
TheM0rt0nator is not online. TheM0rt0nator
Joined: 16 Aug 2014
Total Posts: 387
16 Aug 2017 02:51 PM
I think I fixed it. Thank you for your help :)


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