|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 16 Aug 2017 02:37 PM |
local object = repstorage . Items.Furniture:FindFirstChild(script.Parent.Parent.TextLabel.Text):Clone()
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 16 Aug 2017 02:38 PM |
I get the exact same error if I do this.
|
|
|
| Report Abuse |
|
|
|
| 16 Aug 2017 02:39 PM |
So how could I use an if statement?
|
|
|
| Report Abuse |
|
|
Ajastra
|
  |
| Joined: 01 Aug 2017 |
| Total Posts: 1461 |
|
|
| 16 Aug 2017 02:40 PM |
if thing found then clone end
|
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 01 Aug 2017 |
| Total Posts: 1461 |
|
|
| 16 Aug 2017 02:42 PM |
What is your error in output?
|
|
|
| Report Abuse |
|
|
|
| 16 Aug 2017 02:43 PM |
: attempt to index upvalue 'object' (a nil value)
|
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 16 Aug 2017 02:51 PM |
I think I fixed it. Thank you for your help :)
|
|
|
| Report Abuse |
|
|