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

Do localscripts recognize int/string/bool values? (Fixed Question)

Asked by 10 years ago

I have a tool.

In this tool there is a handle

In this handle there is a localscript

And finally, in this localscript there is an intValue.

The name of the intValue is called "Flag"

And so before even doing anything else, an error is thrown when I attempt:

v = script.Flag

And an error is thrown: "Flag is not a valid member of localscript"

I have then tried v = script:findFirstChild("Flag")

Then when I do a conditional if v.Value == 5 then

Another error is thrown "attempt to index global 'Flag' (a nil value)"

Thus I have no idea whats going on.

1
A bit more information is required, I think. Your error isn't continuous with what you explained as the hierarchy of everything. Why is flag not a valid member of part, when you say the flag is in a tool? Is the Tool named 'part?' MrNicNac 855 — 10y
0
Actually he said the intvalue is inside the LocalScript, and when the Output shows errors it uses ClassNames, however that is irrelevant because we still need more info. Perci1 4988 — 10y

1 answer

Log in to vote
-1
Answered by 10 years ago

For bugfixing, try putting that code in an if loop that reads:

if script:FindFirstChild("Flag")
end

And if that doesnt work, it's a possibility the error is something as small as the object's name being "flag" instead of "Flag"

Ad

Answer this question