Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Solved] Attempt to index local 'val' (a nil value). How to fix?

Asked by 4 years ago
Edited 4 years ago

Okay, so I am making a very simple script that checks an IntValue, but I don't know how to do it, my code is already inefficient, but I just wanna know how to check an IntValue's value, this is what I tried to make sure my code was gonna work

local val = script.Parent.Parent.Parent.Parent:FindFirstChild"AccessLevel"
print(val.Value)

This is how I assumed I would call a value, but it doesn't work, instead I get this error: 16:24:39.867 - Workspace.AccessCard.Handle.SurfaceGui.Frame.Card Level.check:2: attempt to index local 'val' (a nil value), thank you in advance for helping!

1 answer

Log in to vote
0
Answered by 4 years ago

I figured it out. I had too little .Parent's.

0
Edit your title and add [Solved] in front of the title name so that it is marked as being answered. SteelMettle1 394 — 4y
Ad

Answer this question