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

Value is not a valid member?

Asked by
pwnd64 106
8 years ago

I'm trying to rework my chat a bit, and it's giving me a strange error. It tells me that Value is not a valid member, but it is and it is defined by that earlier


InputService.InputBegan:connect(function(Input, gameProcessed) if Input.UserInputType == Enum.UserInputType.Keyboard then if Input.KeyCode == Enum.KeyCode.Slash and Focused.Value == false then --this line Button.BackgroundTransparency = 0.5 Button:CaptureFocus() Focused.Value = true

If you need extra help I can provide

1
How is Focused defined? M39a9am3R 3210 — 8y
0
We need more in order to help out. We need to know the error, as well as the stuff that goes along with the chunk of code. Like, we need to know what Focused is. xxxXMrsAwesomeXxxx 70 — 8y
0
Focused is a boolvalue which is a child of the parent of the script, and it is defined as script.Parent.Focused pwnd64 106 — 8y
0
Did you check capitalization and spelling errors? GoldenPhysics 474 — 8y
0
My guess is that you defined a variable 'focused' as being a reference to 'script.Parent.Focused', but here you refer to it as 'Focused' with a capital 'F'. Also, is it a local variable? If so, is it being defined before your InputBegan callback? If not then that might be another reason why you get this error message. Link150 1355 — 8y

1 answer

Log in to vote
0
Answered by
Ocula 40
8 years ago

There was an issue I had where I couldn't reference a value via a local script. Here's what I did to fix it, I made sure that when I'm defining the variable, I used :WaitForChild(). In this case, you'd use :WaitForChild(), like so:

Focused = script.Parent:WaitForChild("Focused")

I hope this helps.

Ocula

Ad

Answer this question