Help!I have actually worked about a week on this script, yet no progression. I am mostly trying on obtaining the line

function onClick() Check.Frame.Visible = falseendto work yet nothing! I need help obtaining this script to disappear, however my output keeps saying "Attempt to speak to a nil value" I even tried making a nil component in the manuscript by changing false to nil and everything. Please assist me find out what is up through the nil worth what does it mean?!

regional play = manuscript.Parentneighborhood Frame = game.StarterGui.Check.Frameregional Check = game.StarterGui.Checkregional Click = play.MouseButton1Down:connect(onClick)feature onClick() Check.Frame.Visible = falseendPlease aid this is so frustrating!

You watching: Lua attempt to call a nil value

Why"d you unaccept my answer simply to accept one that was simply the same? Even though mine was first? awfulszn 359 — 4y

2 answers

Log in to vote

See more: minecraft how to get invar


Answered by
AstrealDev 723

See more: Farming In Minecraft What To Do With Dirt In Minecraft? : Minecraft

4 years ago

Well, you actually must define the attribute prior to calling it. For example, if I tried to do this:

eatFood("apple")feature eatFood(food) print("I simply ate " .. food)endThat errors:

ServerScriptService.Script:1: attempt to contact international "eatFood" (a nil value)

18:34:10.778 - Stack Begin

18:34:10.778 - Script "ServerScriptService.Script", Line 1

18:34:10.779 - Stack End

It doesn"t actually identify the feature eatFood bereason it hasn"t been identified yet. Scripts are review from peak to bottom, so if I want to contact a function I have to make certain it currently has actually been characterized. Same goes for variables. If I perform this:

print(variable)local variable = "Hi"That will certainly give me an error, and also it will not print. The reason it errors "Attempt to contact a nil value" is bereason the feature hasn"t been defined yet, and also so to Lua does not acknowledge what you"re trying to carry out. It then defines the function as a nil worth. Here"s your manuscript fixed:

neighborhood play = script.Parentregional Frame = game.StarterGui.Check.Frameregional Check = game.StarterGui.Checkfunction onClick() Check.Frame.Visible = falseendneighborhood Click = play.MouseButton1Down:connect(onClick)Hope I assisted, and also if I did be sure to let me understand and accept my answer :)

Categories: WOW