Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my output saying to use a nil value???

I am new to scripting and I am teaching myself which is going smoothly except the output is saying I need a nil value to fix my script

local play = script.Parent
local Frame = game.StarterGui.Check.Frame
local Click = play.MouseButton1Click:connect(onClick)
local Check = game.StarterGui.Check

Check.Frame.Visible = true

function onClick(play)
Check.Frame.Visible = nil
end

the output says attempt to call a nil value

I even tried making the script:

local play = script.Parent
local Frame = game.StarterGui.Check.Frame
local Click = play.MouseButton1Click:connect(onClick)
local Check = game.StarterGui.Check

Check.Frame.Visible = true

function onClick(play)
Check.Frame.Visible = nil
if nil == true then
	Check.Frame.Visible = false
end
end


Please help!

1 comment

0

"attempt to call a nil value" doesn't mean to use a nil value, it's saying you're trying to index (use) a non-existent value.

1 answer

✓ Accepted answer

It's not recommending that you try to call a nil value, it's letting you know that you've already tried.

The problem is that onClick does not exist until line 8 (using your first script), but you attempt to use it on line 3. Line 3 should be after you have defined the function.

In the future, also include what line the error is occurring on, or let us know if there isn't one.

This discussion is preserved as it was. New answers, comments, and votes are closed.