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: need help with a simple line

Previous Thread :: Next Thread 
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
27 Aug 2015 11:42 PM

itemname = Workspace.ORDER1VALUE.Value

if script.Parent.Parent.Parent.Parent.Backpack[itemname].Archivable == true then

I know where the issue is, and it's really simple but for some reason I can't solve it.

It's clearly in the "Backpack[itemname]." part, it's so easy and yet I'm having trouble with it. I know the answer is simple, so don't be all like "OMG THIS IS SO EASY HOW CAN'T YOU FIGURE THIS OUT". qq
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
27 Aug 2015 11:44 PM
if you're just checking if it exists then do this

itemname = Workspace.ORDER1VALUE.Value

if script.Parent.Parent.Parent.Parent.Backpack:FindFirstChild(itemname) then
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
27 Aug 2015 11:55 PM
script.Parent.Parent.Parent.Parent.Backpack:FindFirstChild[itemname].Archivable == true then
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
28 Aug 2015 12:04 AM
I don't think he's using the archivable setting the way it's intended. If you're using the archivable property to check if an object exists, your script will end badly with failed to find nil value
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 01:39 AM
^ Exactly, however the edit you gave me did reduce the NIL error, but it didn't quite work.

Here's the full script if it helps:

playerbackpack = script.Parent.Parent.Parent.Parent.Backpack
itemname = Workspace.ORDER1VALUE.Value
item = playerbackpack:FindFirstChild(itemname)
function clicked()
print(11)
if script.Parent.Parent.Parent.Parent.Backpack:FindFirstChild(itemname) then
Workspace.ya1.Position = Vector3.new(21.41, -0.5, 23.425)
Workspace.NPC1.Humanoid.Health = 0
script.Parent:Destroy()
print(22)
end
end
script.Parent.MouseButton1Down:connect(clicked)
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 02:36 AM
gagagagagaagagagagagaag
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
28 Aug 2015 08:36 AM
slight edit



itemname = Workspace.ORDER1VALUE.Value

if script.Parent.Parent.Parent.Parent.Backpack:FindFirstChild(itemname) ~= nil then


Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 02:19 PM
Same thing, no errors but it doesn't work. The output just repeats 11 every time I push the button.
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 03:10 PM
bamp bamp
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 03:29 PM
gagagagagagagag ollalalala
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 04:12 PM
cries
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 05:45 PM
flopping like a fish
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 06:08 PM
flop flop flop
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 06:50 PM
flap flap flap
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 07:24 PM
aaAAAAAAAAAH
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 07:50 PM
pls
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 08:15 PM
lalala i dare u
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 08:24 PM
dodododododododdo
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 08:48 PM
oooooooka
Report Abuse
Grozztok is not online. Grozztok
Joined: 06 Oct 2012
Total Posts: 87
28 Aug 2015 09:03 PM
uh, instead of "itemname = Workspace.ORDER1VALUE.Value" try "itemname = Workspace.ORDER1VALUE"? otherwise you're setting the variable to the value right
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
28 Aug 2015 09:04 PM
if it just prints 11 tha means

playerbackpack = script.Parent.Parent.Parent.Parent.Backpack
itemname = Workspace.ORDER1VALUE.Value
item = playerbackpack:FindFirstChild(itemname)
function clicked()
print(11)
if script.Parent.Parent.Parent.Parent.Backpack:FindFirstChild(itemname) then
Workspace.ya1.Position = Vector3.new(21.41, -0.5, 23.425)
Workspace.NPC1.Humanoid.Health = 0
script.Parent:Destroy()
print(22)
end
end
script.Parent.MouseButton1Down:connect(clicked)

script.Parent.Parent.Parent.Parent.Backpack:FindFirstChild(itemname) is false
are you sure its not false?
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 09:55 PM
lalalalala
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 09:55 PM
o, yeah I'm sure it's not false
Report Abuse
Lucargia is not online. Lucargia
Joined: 25 Jan 2013
Total Posts: 371
28 Aug 2015 11:18 PM
mmmmmmmmmmmahlalala
Report Abuse
SneakySecretAgent is not online. SneakySecretAgent
Joined: 28 Sep 2011
Total Posts: 323
28 Aug 2015 11:21 PM
You don't just print values like that. Consider using

itemname = Workspace.ORDER1VALUE
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